Skip to content
Snippets Groups Projects
Commit 9cac0e9a authored by Ryan Harg's avatar Ryan Harg
Browse files

Merge branch 'bugfix/120-bluetooth-buttons-unresponsive' into 'develop'

Fix Bluetooth control button unresponsiveness.

Closes #120

See merge request !171
parents c11be2c8 857129ef
No related branches found
No related tags found
1 merge request!171Fix Bluetooth control button unresponsiveness.
Pipeline #21153 passed
...@@ -2,6 +2,7 @@ package audio.funkwhale.ffa.playback ...@@ -2,6 +2,7 @@ package audio.funkwhale.ffa.playback
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.ResultReceiver import android.os.ResultReceiver
import android.support.v4.media.session.MediaSessionCompat import android.support.v4.media.session.MediaSessionCompat
...@@ -44,13 +45,17 @@ class MediaSession(private val context: Context) { ...@@ -44,13 +45,17 @@ class MediaSession(private val context: Context) {
it.setMediaButtonEventHandler { _, _, intent -> it.setMediaButtonEventHandler { _, _, intent ->
if (!active) { if (!active) {
context.startService( Intent(context, PlayerService::class.java).let { player ->
Intent(context, PlayerService::class.java).apply { player.action = intent.action
action = intent.action
intent.extras?.let { extras -> putExtras(extras) } intent.extras?.let { extras -> player.putExtras(extras) }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(player)
} else {
context.startService(player)
}
} }
)
return@setMediaButtonEventHandler true return@setMediaButtonEventHandler true
} }
......
Fix unresponsive bluetooth buttons with Oreo and later (thanks @hdash)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment