点击Android TV(Oreo)中的频道后打开应用

问题描述 投票:1回答:1

在这张图片中:

enter image description here

我检查了 :

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

在第3号,它们是应用程序,

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

但我的应用程序无法点击并打开,

请告诉我哪个属性需要定义在哪里让我的应用程序可以点击并直接打开应用程序?

谢谢,

android android-tv
1个回答
1
投票

做了一些研究之后,我找到了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();
© www.soinside.com 2019 - 2024. All rights reserved.