Reputation: 709
When handling mediaButton events originating from remote controls or headsets, the Android documentation states here:
On Android 5.0 (API level 21) and higher, Android automatically dispatches media button events to your active media session
So if the active MediaSession
picks up media button events, why would it still be necessary for an API 21+ app to register a MediaButtonReceiver
and let your MediaBrowserService
(or other Service
) listen to MEDIA_BUTTON
intents?
<receiver android:name="android.support.v4.media.session.MediaButtonReceiver" >
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
Upvotes: 0
Views: 27