playback: expose media button receiver

Expose a custom MediaButtonReceiver that handles the media button
intent. This is not because I wanted to implement this. Some apps
like gadgetbridge just blindly query ACTION_MEDIA_BUTTON instead of
relying on the more modern MediaController API, which I expected
most apps would use instead.

Resolves #62.
This commit is contained in:
OxygenCobalt
2022-01-25 17:20:26 -07:00
parent c9f789e388
commit 317b12579c
11 changed files with 107 additions and 82 deletions
+6 -11
View File
@@ -50,8 +50,11 @@
</intent-filter>
</activity>
<!--
Workaround to get apps that blindly query for apps handling media buttons working
-->
<receiver
android:name="androidx.media.session.MediaButtonReceiver"
android:name=".playback.system.MediaButtonReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
@@ -62,16 +65,8 @@
android:name=".playback.system.PlaybackService"
android:foregroundServiceType="mediaPlayback"
android:icon="@mipmap/ic_launcher"
android:exported="true"
android:roundIcon="@mipmap/ic_launcher">
<!--
Workaround to get apps that search for media apps by checking for a BroadcastReceiver
to detect Auxio, as we let the media APIs handle this.
-->
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</service>
android:exported="false"
android:roundIcon="@mipmap/ic_launcher" />
<receiver
android:name=".widgets.WidgetProvider"