I am trying to select a program on the home screen but I keep getting a toast that says "Can't open this right now".
Here is my manifest and how my program get's added to the TV Provider. I am setting the intent uri, internal provider id and content id to be thorough.
Based on the logs, it looks like my receiver is never launched.
Class that adds programs to the TV Provider:
private static final Uri BASE_URI = Uri.parse(SCHEME + "://" + APPS_LAUNCH_HOST);
public static final String START_APP_ACTION_PATH = "startapp";
public static final String PLAY_VIDEO_ACTION_PATH = "playvideo";
public void addProgram(Movie movie) {
...
PreviewProgram.Builder builder = new PreviewProgram.Builder()
.setChannelId(channelId)
.setTitle(movie.getTitle())
.setDescription(movie.getDescription())
.setDurationMillis(Long.valueOf(movie.getDuration()).intValue())
.setType(TvContractCompat.PreviewPrograms.TYPE_MOVIE)
.setIntentUri(Uri
.withAppendedPath(BASE_URI, PLAY_VIDEO_ACTION_PATH)
.buildUpon()
.appendPath(movieId)
.build())
.setInternalProviderId(movieId)
.setContentId(movieId)
...
}
public static long parseVideoId(Uri uri) {
List<String> segments = uri.getPathSegments();
if( segments.size() == 2 && PLAY_VIDEO_ACTION_PATH.equals(segments.get(0)) ) {
return Long.valueOf(segments.get(1));
}
return -1L;
}
Android Manifest
<receiver android:name=".PlayVideoReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:scheme="<scheme>"
android:host="<host>"
android:path="/playvideo" />
</intent-filter>
</receiver>