I try to use android's mediabrowser and sample by google works fine on phones (https://github.com/googlesamples/android-media-controller)
But on android TV it can't find any app which supported this feature
final Intent mediaBrowserIntent =
new Intent(MediaBrowserServiceCompat.SERVICE_INTERFACE);
final List<ResolveInfo> services =
packageManager.queryIntentServices(mediaBrowserIntent,
PackageManager.GET_RESOLVED_FILTER);
in services placed only current app
Could you help me get API to collect last used mediadata? I can't find any description or guide for creating TV launcher (which have access to last used or recommended media by another app)
I just wanna GET metadata like https://developer.android.com/training/tv/playback/now-playing.html or http://corochann.com/android-tv-application-hands-on-tutorial-11-277.html
You can query for all active media sessions using the method MediaSessionManager.getActiveSessions(notificationListnerComponentName) which will return a list of alla ctive mediacontrollers with the most active as the first item in the list. Code sample:
MediaSessionManager mediaSessionManager = context.getSystemService(Context.MEDIA_SESSION_SERVICE);
List<MediaController> activeMediaSessionControllers = mediaSessionManager.getActiveSessions(null);