Jump to content

Prevent starting on bluetooth press


eng3

Recommended Posts

I have a samsung galaxy buds 2 pro.  If I have "respond to buttons" enabled in the app, it response to buttom presses fine.  However, even when the app is off, if I press the button it will usually startup the app and start playing.  Sometimes this happens even if I'm listening to something in another app.

Is there a way to disable this? Unchecking "respond to buttons" works but then it doesnt work while playing a song.  I want to be able to start/stop/skip a song while I'm using the app but not if its closed.

I realize sometimes apps stick around for a while, maybe don't response anymore if the song is paused for more than a certain amount of time (15min?)

I do have the setting for it to pause if I disconnect the bluetooth.

Link to comment
Share on other sites

10 hours ago, andrewilley said:

You could try disabling Keep Service and also disable Keep Notifications / Keep Inactive Media Notifications in Settings=>Look and Feel=>Notifications.

Andre

Keep service is already disabled but not keep notifications.

I tried doing that but it made no difference.

Here is the log

 

 

When connecting the Bluetooth

09:46:24.261 BTReceiver headset event

connection BT=true am mode=0 Galaxy Buds2 Pro

==================

09:46:24.695 PlayerService onRoutingChanged

newDevice=bt oldDevice=speaker

==================

09:46:24.695 PlayerService reloadPipeline

 allowPlaying=true forceResume=false state after reload=2

 

 

 

 

Pressing the button

==================

09:46:35.504 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON

KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=138907376 sourcePak=com.android.bluetooth isAvrcp flags=0x0 playerState=2

==================

09:46:35.510 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON

KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=138907382 sourcePak=com.android.bluetooth isAvrcp flags=0x0 playerState=2

================

==

09:46:35.525 PlayerService RESUME

from PSMediaButtonReceiver resumePlaying 

 

Link to comment
Share on other sites

@eng3 if Poweramp is last used music player, Android will resume it next time "resume" button is pressed. (The resume "button", or command, may be just a single press on buds, or double press, etc. - depending on the headset/device/firmware). Some Android 13 firmwares have bug when Poweramp "Beep" option always makes Poweramp as last active player for some reason. Workaround for that was added to Poweramp build-975 (or you can temporarily disable Beep option). Thanks!

Link to comment
Share on other sites

I don't use the beep option either.

I mainly use Google podcasts and Poweramp. I notice if I start podcasts then closer it, the button will still trigger Poweramp. I notice they the button will only resume your app (opening the app) whereas my other apps don't seem to do this.

 

Is your app doing something that is more "aggressive"?

 

Or maybe a feature to only respond when in the foreground or if the notification is active? 

Link to comment
Share on other sites

On 9/13/2023 at 9:09 AM, eng3 said:

I don't use the beep option either.

I mainly use Google podcasts and Poweramp. I notice if I start podcasts then closer it, the button will still trigger Poweramp. I notice they the button will only resume your app (opening the app) whereas my other apps don't seem to do this.

 

Is your app doing something that is more "aggressive"?

 

Or maybe a feature to only respond when in the foreground or if the notification is active? 

Any response to this or other ideas? 

Link to comment
Share on other sites

As Android is sending the KEYCODE_MEDIA_PLAY ACTION_DOWN intent to Poweramp (as shown in the log) Poweramp is really just doing what it's told. I'm not sure why your Android is not sending button events to the currently-in-use media player when you are listening to something in another media player app though. 

Andre

Link to comment
Share on other sites

Strange, today it didn't work at all even with Poweramp in the foreground and everything else closed. But it works with Google podcasts and mx player. 

 

==================

07:32:29.129 BTReceiver headset event

connection BT=true am mode=0 Galaxy Buds2 Pro

==================

07:34:43.853 PSAudioFocusHelper AUDIOFOCUS_LOSS

IGNORE !playing

==================

07:34:52.683 PlayerService TOGGLE_PLAY_PAUSE

from NotificationHelperViaBuilder resumePlaying 

==================

07:34:53.636 PlayerService TOGGLE_PLAY_PAUSE

from NotificationHelperViaBuilder pausePlaying 

==================

07:34:57.165 PSAudioFocusHelper AUDIOFOCUS_LOSS

IGNORE !playing

Edited by eng3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...