android - 从 Android TV (Oreo) 中的 channel 点击后打开应用

标签 android android-tv

在这张图片中:

enter image description here

我检查过:

  • 1 号和 3 号:可以点击并打开

在数字 3 中,它们是应用程序,

我也在开发自己的应用程序,可以在数字 3 中显示。

但是我的应用无法点击打开,

请建议我需要在何处定义哪个属性,以便让我的应用程序可以点击并直接打开应用程序?

谢谢,

最佳答案

经过一些研究,我找到了this Document做。

  • 必须使用:setAppLinkIntentUri() 方法

  • 重新安装应用

如下代码

// NOTE : THESE INFO MUST MATCH WITH DATA IN MANIFEST.XML
    String SCHEME = "xxx";
    String HOST = "xxx";
    String PATH = "xxx";

    ComponentName componentName = new ComponentName(context, MainActivity.class.getName());
    String channelInputId = TvContractCompat.buildInputId(componentName);

    // Design Channel Data on Launcher in here
    Channel channel = new Channel.Builder()
            .setDisplayName(mContext.getString(R.string.mv_hot_title))
            .setType(TvContractCompat.Channels.TYPE_PREVIEW)
            .setInputId(channelInputId)
            .setAppLinkIntentUri(Uri.parse(SCHEME + "://" + HOST + "/" + PATH))
            .build();

关于android - 从 Android TV (Oreo) 中的 channel 点击后打开应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55584238/

相关文章:

jquery - phonegap,连接到服务器失败

java - 什么会导致 close(2) 因只读文件的 EIO 而失败?

android - 使用 createPendingResult 从服务回调

java - 将 friend 列表和对象 ID 从图形 API 传递到另一个 Activity

android - Jetpack 组合底部应用栏深色

android - ViewPager 类似于 AndroidTV 中 BrowseFragment 中的东西

android - 关于缺少 Leanback Intent 的 Google Play 警告

android - 将 Android 应用程序限制为 Android TV

Android TV 运营商等级

android - 谷歌地图在长时间打开时在 Android TV 中闪烁