Missing permission to manage media error on Android 5 / L

Missing permission to manage media error on Android 5 / L

Get the following error on this line when trying to configure RemoteController. I could not find any information about this error, so I would like to post an error message and a simple solution.

The code that called it:

if(!((AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE)).registerRemoteController(mRemoteController)) {...} 

Mistake:

 E/AndroidRuntime(21073): FATAL EXCEPTION: main E/AndroidRuntime(21073): Process: com.example.widgetdemo, PID: 21073 E/AndroidRuntime(21073): java.lang.SecurityException: Missing permission to control media. E/AndroidRuntime(21073): at android.os.Parcel.readException(Parcel.java:1540) E/AndroidRuntime(21073): at android.os.Parcel.readException(Parcel.java:1493) E/AndroidRuntime(21073): at android.media.session.ISessionManager$Stub$Proxy.addSessionsListener(ISessionManager.java:274) E/AndroidRuntime(21073): at android.media.session.MediaSessionManager.addOnActiveSessionsChangedListener(MediaSessionManager.java:208) E/AndroidRuntime(21073): at android.media.RemoteController.startListeningToSessions(RemoteController.java:796) E/AndroidRuntime(21073): at android.media.AudioManager.registerRemoteController(AudioManager.java:2530) E/AndroidRuntime(21073): at com.example.widgetdemo.RemoteControlService.setRemoteControllerEnabled(RemoteControlService.java:68) E/AndroidRuntime(21073): at com.example.widgetdemo.MainActivity$3.onServiceConnected(MainActivity.java:216) E/AndroidRuntime(21073): at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1203) E/AndroidRuntime(21073): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1220) 
+2
android android-audiomanager
Jan 16 '15 at 21:58
source share
1 answer

The user must explicitly grant your permission to access the notification application by going to Settings β†’ Sound and notification β†’ Access notification β†’ Select the checkbox next to your application

+2
Jan 16 '15 at 21:58
source share



All Articles