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

标签 xamarin xamarin.android xamarin.forms

您好,我有一个与手机/平板电脑和我的电视 Android Box 兼容的应用程序。
然而,这个应用程序与我的 Android 智能电视本身不兼容,比如当我去谷歌播放(这是 Alpha)时,我收到文本说该应用程序与设备不兼容。

我做了一些检查,我发现应用程序的 list 应该提到这是一个 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
    {...

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

最佳答案

我找到了解决方案

在 mainActivity 中,您按照我在 Quesiton 中所做的方式开始上课

[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
{...

在 list 中,您必须添加以下内容
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />

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

关于xamarin - 如何使我的应用程序与智能电视兼容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37918167/

相关文章:

android - GoogleMaps 标记 OnClick - Xamarin

android - MvvmCross:如何以编程方式构建带有自定义适配器的 MvxListView?

c# - Xamarin 中的自定义对话框宽度和高度

Xamarin Forms 网格中的右对齐按钮

c# - Xamarin.Forms System.Threading.Tasks.TaskCanceledException

mvvm - Xamarin表格: Is Reactive Extensions (Rx) a framework that replaces MVVM pattern?

ios - 使用 Xamarin.Forms 应用填充 iPhone X 屏幕

Xamarin.Forms 如何在代码中添加行为

ios - MVVM跨iOS : how to bind a command with Custom transition when switching to different View model

c# - 如何在 Android 的单声道上制作类似 evernote 的菜单