Movie Deeplink for Netflix Android TV app (com.net

2020-06-29 07:41发布

I have seen solutions on how to do movie deeplinking for Netflix for the mobile Netflix app, but for the Android TV version of the app those same solutions don't seem to be working.

I have tried using an Intent with action.VIEW and passing the normal Netflix URL such as: http://www.netflix.com/watch/{movieId} or with the nflx:// protocol.

For the android TV app only the nflx:// protocol seems to do anything where it opens the app and then it just stays at the main menu instead of playing the movie. Using the http:// protocol opens to netflix in the browser where it just asks you to download the phone or tablet app.

Has anyone been able to figure this out?

2条回答
混吃等死
2楼-- · 2020-06-29 08:15

I wanted the same, so I spent some time digging. It had to be possible because Netflix series and movies show up in the Android TV launcher search results and can be launched from there. Apparently there are intent extras in that intent and they are the missing piece. The biggest problem was that there is no easy way to capture those intent extras (logcat doesn't show the extras), still I found a way. The following code does what you want:

Intent netflix = new Intent();
netflix.setAction(Intent.ACTION_VIEW);
netflix.setData(Uri.parse("http://www.netflix.com/watch/70202141"));
netflix.putExtra("source","30"); // careful: String, not int
netflix.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);
getActivity().startActivity(netflix);

Alternatively, through adb:

adb shell am start -c android.intent.category.LEANBACK_LAUNCHER -a android.intent.action.VIEW -d http://www.netflix.com/watch/70202141 -f 0x10808000 -e source 30 com.netflix.ninja/.MainActivity

This way I can launch right into a movie or series and it automatically starts playing. To launch into the screen without automatic playback, use /title/ instead of /watch/. Tested on netflix ninja 3.3.1 build 1513 for Android TV on arm.

查看更多
爷、活的狠高调
3楼-- · 2020-06-29 08:23

Netflix recently added universal search support to Android TV, which means there had to be some way to deep link to shows and movies. So I found a few flags you need to set to correctly open the show page. It seems like there are also extras which could be used to automatically start playing.

public void OpenNFX() {
    Intent netflix = new Intent();
    netflix.setAction(Intent.ACTION_VIEW);
    netflix.setData(Uri.parse("http://www.netflix.com/watch/70291117"));
    netflix.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);
    getActivity().startActivity(netflix);
}
查看更多
登录 后发表回答