从 Android 电视 (Oreo) 频道点击后打开应用
Open app after clicked from Channel in Android TV (Oreo)
在此图像中:
我检查过:
- 1 号和 3 号:可以点击打开。
在数字 3 中,它们是应用程序,
我也在开发自己的应用程序,可以在第3个中展示。
但是我的App无法点击打开,
请建议我需要在何处定义哪个属性以便使我的应用程序可以点击并直接打开应用程序?
谢谢,
经过一些研究,我发现 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();
在此图像中:
我检查过:
- 1 号和 3 号:可以点击打开。
在数字 3 中,它们是应用程序,
我也在开发自己的应用程序,可以在第3个中展示。
但是我的App无法点击打开,
请建议我需要在何处定义哪个属性以便使我的应用程序可以点击并直接打开应用程序?
谢谢,
经过一些研究,我发现 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();