如何使我的应用程序与智能电视兼容?

Ahm*_*adi 5 xamarin.android xamarin xamarin.forms

你好,我有一个与手机/平板电脑和我的电视Android Box兼容的应用程序.然而,这个应用程序与我的Android智能电视本身不兼容,就像我去谷歌播放(这是阿尔法)我得到的文字说,该应用程序与该设备不兼容.

我做了一些检查,我发现应用程序的清单应该提到这是一个LEANBACK_LAUNCHER,我做了类似下面的代码:

[Activity(Label = "Afaq.IPTV", Icon = "@drawable/icon", MainLauncher = true,
        ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    [IntentFilter(new[] {"android.intent.action.MAIN"}, AutoVerify = true,
        Categories = new[] {"android.intent.category.LEANBACK_LAUNCHER"})]
    public class MainActivity : FormsApplicationActivity
    {...
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?以前有人成功吗?

Ahm*_*adi 0

我找到了解决方案

在 mainActivity 中,您按照我在问题中所做的方式开始课程

[Activity(Label = "Afaq.IPTV", Icon = "@drawable/icon", MainLauncher = true,
    ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]

[IntentFilter(new[] { Intent.ActionMain }, Categories = new[] {Intent.CategoryLauncher,Intent.CategoryLeanbackLauncher})]


public class MainActivity : FormsApplicationActivity
{...
Run Code Online (Sandbox Code Playgroud)

在清单中,您必须添加以下内容

<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
Run Code Online (Sandbox Code Playgroud)

添加此行后,您将在电视上的 Google Play 商店中获得一个应用程序。但是,如果清单中只有此内容,则您的应用程序与触摸屏设备(例如手机和平板电脑)不兼容。谷歌这个问题,你可能会发现一些有用的东西可以解决这个问题。我的猜测是通过另一个针对手机的 Activity 。