Cannot get an instance of MediaSessionManager with getSystemService()

1k views Asked by At

I've been trying out the new Android Lollipop APIs, especially the new media playback control framework. In the documentation, it says to get an instance of the new MediaSessionManager, I have to call getSystemService(MEDIA_SESSION_MANAGER). However, writing the code in Android Studio gives an error saying the argument can only be one of List of services like POWER_SERVICE, WINDOW_SERVICE, VIBRATOR_SERVICE etc.

I think it might be a bug with Android studio but I have no probably using all the other new APIs introduced in Lollipop. I have the final Lollipop SDK installed on my system.

1

There are 1 answers

0
mangini On BEST ANSWER

You should be able to get an instance of MediaSessionManager by calling context.getSystemService(Context.MEDIA_SESSION_SERVICE)

You apparently have a typo: you wrote MEDIA_SESSION_MANAGER instead of MEDIA_SESSION_SERVICE.

PS: you didn't copy the Android Studio error message correctly in your question, so I can't see what goes after "saying the argument can only be one of". If you are actually using Context.MEDIA_SESSION_SERVICE but still get an error, please edit your original question and quote the error message correctly.