Android Tv Mediacontroller

Android Tv Mediacontroller

I try to use android's mediabrowser and sample by google works fine on phones ()

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 or

1 Answer

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);
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.