I need to list the active audio sessions. I am using the next code:
MediaSessionManager mediaSessionManager = (MediaSessionManager)
getSystemService(Context.MEDIA_SESSION_SERVICE);
ComponentName componentName = new ComponentName(this,
NotificationListenerExampleService.class);
List<MediaController> controllers =
mediaSessionManager.getActiveSessions(componentName);
Error: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.bassbooster/com.example.bassbooster.MainActivity}: java.lang.SecurityException: Missing permission to control media.
The permission "android.Manifest.permission.MEDIA_CONTENT_CONTROL", is only for system apps.
How can i list the active audio sessions?
Thanks for reading.