Jump to content

Poweramp auto start when bluetooth connected


Vee

Recommended Posts

@eng3 if from the log there is MEDIA_RESUME command, it will be catched and last played audio player will resume. If it doesn't work this way - it's generally a bug (player does not respond to MEDIA commands, which are usually the commands from headset buttons, some lockscreens, or car headunits). I guess some option is possible to ignore some MEDIA_* commands, but this may be hard to tune properly as the affected headunit (which sends MEDIA_RESUME action, usually due to some "Resume" option on connect in it).

Link to comment
Share on other sites

  • 1 month later...
  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Delighted (if you can say that) that I'm not alone with this annoying issue on Poweramp (which has been my sole audio player since I moved to Android 13 years ago). I do not that *no other audio player* I use (e.g. Podcast Addict) exhibits this behavior, and that it only happens in my non-Android Auto vehicle (and it happened in my last vehicle as well). Hence, whatever signal my auto is sending Poweramp, other Android apps are capable of ignoring it. Curious whether an adb command can kill it (between reboots).

Link to comment
Share on other sites

@hgoldner As far as we can tell, the commands sent are genuine - so technically Poweramp should respond to them, which is what it it correctly doing. PA already ignores any such commands sent in the first couple of seconds after a  BT connection. Please could you check PA Settings=>Headset/Bluetooth=>Last Processed Commands and see if your device is sending keypress events just after the BT connection has been made - such as KEYCODE_MEDIA_PLAY, KEYCODE_MEDIA_PLAY_PAUSE, or even KEYCODE_MEDIA_PAUSE. That last one technically should specifically mean to pause playback, but so many devices incorrectly send it as a toggle command that it generally makes more sense to treat it in the same way as the official toggle command, PLAY_PAUSE. 

Andre

Link to comment
Share on other sites

@hgoldner I would say players with own audio engines may be affected by this kind of bug. OEM may test their firmware with the stock Android audio engine, but anything non-standard is often untested and is affected by the issue. As most players on Android are just UI for the stock media engine, these are free from the bug. Players like Poweramp, UAPP, Neutron may be affected.

Anyways, it's rare - I can't reproduce anything like this for my test devices, so it may be also a combination of Android device, BT device, firmware, and app environment on the device.

Nevertheless, I will include options to skip any BT commands for xx seconds after connection + also option to ignore shuffle/repeat BT commands.

Link to comment
Share on other sites

2 hours ago, maxmp said:

@hgoldner I would say players with own audio engines may be affected by this kind of bug. OEM may test their firmware with the stock Android audio engine, but anything non-standard is often untested and is affected by the issue. As most players on Android are just UI for the stock media engine, these are free from the bug. Players like Poweramp, UAPP, Neutron may be affected.

Anyways, it's rare - I can't reproduce anything like this for my test devices, so it may be also a combination of Android device, BT device, firmware, and app environment on the device.

Nevertheless, I will include options to skip any BT commands for xx seconds after connection + also option to ignore shuffle/repeat BT commands.

I think "skip any BT commands for xx seconds after connection" is a very good idea to try to solve this issue.

I don't think it does much for the other issue I was having though (accidental press starts PA even when app is not active).  I was able to work around it by having tasker intercept the command and close PA if the notification was not present.  I basically monitor logcat for "Zenith_SppRecvThread RECV++: FD" then check for the notification.  If NOT present, I use the PA API to stop the service.  It works because it is able to check for the notification before PA launches itself.  Then once it launches, I guess it sees the API command and stops.  I'll hear music for about a second before it stops.

An option in PA to ignore BT if notification is not active would be nice too.

Link to comment
Share on other sites

I notice that Musicolet has a 'prevent unwanted autoplay' setting that addresses this exact issue. When enabled, Musicolet ignores all 'Play commands' for a few seconds after connecting/disconnecting to a device. This seems to be a better response than saying, 'It's your car's fault and nothing to do with us.'

One trick I have found to get around this issue in my otherwise-beloved music player is to find some tracks of total silence on the internet and make them into an album of silence. I put tags like '!Silence!' in the album artist, title and genre. If I can remember, I just play a track of silence, knowing that when my car tells Poweramp to play whatever it has going, at least I won't get that nerve-jangling experience of unwanted autoplay when I get in the car.

Link to comment
Share on other sites

@Michael Glasson  PA already ignores commands for the first few seconds after connection. Clearly it can't do so forever though as that would break your ability to use the buttons at all. In 'Last Processed Commands', how long after the connection has been established does the unwanted playback command from your headunit appear?

One quick question - do you use the Poweramp Equalizer app on your phone, as well as the main Poweramp Music Player? That app has its own 'Resume on Connection' settings so it's worth checking that they are turned off too.

Andre

Link to comment
Share on other sites

@andrewilley, it appears that it is taking Our A3 8 seconds to issue the RESUME command after the Bluetooth connection is made. Two 'turn on ignition' events are shown below with Poweramp Resume on Bluetooth switched OFF. In both cases, Bluetooth reconnects at 12 seconds past the minute and car issues KEYCODE_MEDIA_PLAY ACTION_DOWN at 20 seconds past the minute. Potential fix might be to have Poweramp ignore media keys for a user settable amount of time, say from 0 seconds to 30 seconds from Bluetooth reconnection.

==================
08:35:12.488 BTReceiver headset event
connection BT=true am mode=0 Our A3
==================
08:35:12.662 PlayerService onRoutingChanged
newDevice=bt oldDevice=speaker
==================
08:35:12.662 PlayerService reloadPipeline
allowPlaying=true forceResume=false state after reload=2
==================
08:35:20.850 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392574974 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=2
==================
08:35:20.864 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
08:35:21.061 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392575185 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
08:35:21.067 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
08:35:28.175 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392582299 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
08:35:28.524 BTReceiver headset event
disconnection BT=true am mode=0 Our A3 no_keep_notif_on_dscn=true
==================
08:35:28.524 BTReceiver cmd_player_pause_playing
==================
08:35:28.549 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=true
==================
08:35:28.549 HeadsetPlugReceiver cmd_player_remove_notif
==================
08:35:29.554 PlayerService onRoutingChanged
newDevice=speaker oldDevice=bt
==================


==================
08:36:12.482 BTReceiver headset event
connection BT=true am mode=0 Our A3
==================
08:36:12.654 PlayerService onRoutingChanged
newDevice=bt oldDevice=speaker
==================
08:36:12.654 PlayerService reloadPipeline
allowPlaying=true forceResume=false state after reload=2
==================
08:36:20.590 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392634714 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=2
==================
08:36:20.600 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
08:36:20.817 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392634941 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
08:36:20.820 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
08:36:26.789 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392640913 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
08:36:27.152 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=true
==================
08:36:27.152 HeadsetPlugReceiver cmd_player_pause_playing
==================
08:36:27.154 BTReceiver headset event
disconnection BT=true am mode=0 Our A3 no_keep_notif_on_dscn=true
==================
08:36:27.154 BTReceiver cmd_player_pause_playing
==================
08:36:31.151 PlayerService onRoutingChanged
newDevice=speaker oldDevice=bt
 

 

Link to comment
Share on other sites

17 minutes ago, Michael Glasson said:

@andrewilley, it appears that it is taking Our A3 8 seconds to issue the RESUME command after the Bluetooth connection is made. Two 'turn on ignition' events are shown below with Poweramp Resume on Bluetooth switched OFF. In both cases, Bluetooth reconnects at 12 seconds past the minute and car issues KEYCODE_MEDIA_PLAY ACTION_DOWN at 20 seconds past the minute. Potential fix might be to have Poweramp ignore media keys for a user settable amount of time, say from 0 seconds to 30 seconds from Bluetooth reconnection.

==================
08:35:12.488 BTReceiver headset event
connection BT=true am mode=0 Our A3
==================
08:35:12.662 PlayerService onRoutingChanged
newDevice=bt oldDevice=speaker
==================
08:35:12.662 PlayerService reloadPipeline
allowPlaying=true forceResume=false state after reload=2
==================
08:35:20.850 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392574974 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=2
==================
08:35:20.864 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
08:35:21.061 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392575185 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
08:35:21.067 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
08:35:28.175 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392582299 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
08:35:28.524 BTReceiver headset event
disconnection BT=true am mode=0 Our A3 no_keep_notif_on_dscn=true
==================
08:35:28.524 BTReceiver cmd_player_pause_playing
==================
08:35:28.549 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=true
==================
08:35:28.549 HeadsetPlugReceiver cmd_player_remove_notif
==================
08:35:29.554 PlayerService onRoutingChanged
newDevice=speaker oldDevice=bt
==================


==================
08:36:12.482 BTReceiver headset event
connection BT=true am mode=0 Our A3
==================
08:36:12.654 PlayerService onRoutingChanged
newDevice=bt oldDevice=speaker
==================
08:36:12.654 PlayerService reloadPipeline
allowPlaying=true forceResume=false state after reload=2
==================
08:36:20.590 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392634714 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=2
==================
08:36:20.600 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
08:36:20.817 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392634941 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
08:36:20.820 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
08:36:26.789 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=392640913 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
08:36:27.152 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=true
==================
08:36:27.152 HeadsetPlugReceiver cmd_player_pause_playing
==================
08:36:27.154 BTReceiver headset event
disconnection BT=true am mode=0 Our A3 no_keep_notif_on_dscn=true
==================
08:36:27.154 BTReceiver cmd_player_pause_playing
==================
08:36:31.151 PlayerService onRoutingChanged
newDevice=speaker oldDevice=bt
 

 

I have an Audi A3 too and for me, that's the definitive solution. @andrewilley

Link to comment
Share on other sites

Are you sure there isn't a setting in the A3 headunit menus to disable this? Seems strange to automatically force a PLAY command 8 seconds after connection.

If not, then yes there would need to be an optional ignore period to workaround their poor design choices, as we wouldn't want all other users blocked from using their Bluetooth devices for 8+ seconds.

Andre

Link to comment
Share on other sites

1 hour ago, andrewilley said:

Are you sure there isn't a setting in the A3 headunit menus to disable this? Seems strange to automatically force a PLAY command 8 seconds after connection.

If not, then yes there would need to be an optional ignore period to workaround their poor design choices, as we wouldn't want all other users blocked from using their Bluetooth devices for 8+ seconds.

Andre

Absolutely sure there is not. 

Link to comment
Share on other sites

2 minutes ago, mOuStAcHe_BR said:

Absolutely sure there is not. 

This is precisely why other media apps have an option to ignore

 

My suggestion, an option to ignore unless Poweramp window is open or notification is active.  Or an option to ignore after hitting pause/stop after a user specified timeout

Edited by eng3
Link to comment
Share on other sites

Potentially good possibilities there @eng3, @andrewilley. My current workaround is to have an album consisting of one track of mp3 silence. If I remember to play that album before I get in the car, there is no sudden music just when I am trying to back out of a shopping centre car par.

PS, sorry to call you Andrew Andre.

Edited by Michael Glasson
Link to comment
Share on other sites

  • 1 month later...

With thanks to @andrewilley, @maxmp and @mOuStAcHe_BR for helping to implement this feature. It seems to have stopped the unwanted behaviour in our A3. Yay! This issue has been going for a while, so it is excellent to have a resolution. 

I was a little anxious when I saw that the user configurable delay was only 10 seconds, as it is a little close to the documented 8 second delay between Bluetooth connection and the head unit initiated play command. In practice, however, I picked the 10 second max and Poweramp does indeed ignore the play command.

Link to comment
Share on other sites

35 minutes ago, andrewilley said:

@maxmp Might be worth increasing the maximum time value for the 'Ignore' feature to maybe 20 seconds? Just to cover the really excessive delays that some users previously reported, no one else has to use that large a period of course.

Andre

That's exactly what I am waiting for...

Link to comment
Share on other sites

  • 3 weeks later...

I'm just chiming in to say I have the same issue. I don't use android auto, but still tried the fix earlier in the thread. All my audio focus settings are off, no auto starting enabled. I drive multiple short distances with clients in the car, and man is it embarrassing when Poweramp starts playing my music even if I wasn't listening to music last time in the car. Or if I start using my earbuds to finish watching a video on yt and Poweramp aggressively takes over. I understand Poweramp is acting "correctly" yet this is still an issue. No other music app behaves this way. I've been using Poweramp for years (paid) but I had to uninstall to keep my sanity. 

Link to comment
Share on other sites

@brooks Did you actually try the feature added in recent test builds? Currently build 981 supports ignoring spurious BT commands for up to 10 seconds after connection, and that range will be increased to 20 seconds in the next build.

Also, do you have any other app which creates the same command installed - e.g. the stand-alone Poweramp Equalizer app can also detect BT connections and issue play commands accordingly. 

Andre

Link to comment
Share on other sites

@andrewilley  Is there a way to force a update? I'm on build 976, so I don't have the spurious BT command option. but have checked updates for the app and it doesn't have any.

Edit: I just found there is a option to join bata downloads on the app download screen.

Ryan

Edited by Panzom
found what my question was about.
Link to comment
Share on other sites

  • 2 weeks later...

Hello,
I have similar problems.
I had a Samsung S23 Ultra with this behavior and now I have a Samsung S24 Ultra also with the same problem.
In Poweramp I have switched

  • Resume on Wired Headset off
  • Resume on Bluetooth off

I don't have Poweramp Equalizer

I'm running version build-981-bundle-play [981004-ed39e1a4]
I already uninstalled the tool from Sennheiser 'Smart Control'
I have a Sennheiser Momentum 4.
I haven't sen specific problems for specific brands.
I include the last processed commands

==================
17:11:09.940 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=1532665 sourcePak=com.android.bluetooth isAvrcp flags=0x0 playerState=0
==================
17:11:10.183 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=1532908 sourcePak=com.android.bluetooth isAvrcp flags=0x0 playerState=0
==================
17:11:10.617 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
17:11:11.706 PlayerService reloadPipeline
 allowPlaying=true forceResume=false state after reload=1
==================
17:11:11.757 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
17:11:12.199 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=1534923 sourcePak=com.android.bluetooth isAvrcp IGNORED due ignore_bt_sec lastRouteTimeDiff=411 lastBTTimeDiff=1708445472198
==================
17:11:12.209 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=1534934 sourcePak=com.android.bluetooth isAvrcp IGNORED due ignore_bt_sec lastRouteTimeDiff=422 lastBTTimeDiff=1708445472209
==================
17:11:13.133 BTReceiver headset event
disconnection BT=true am mode=0 MOMENTUM 4 no_keep_notif_on_dscn=false
==================
17:11:13.133 BTReceiver cmd_player_pause_playing
==================
17:11:13.160 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
17:11:13.160 HeadsetPlugReceiver cmd_player_pause_playing
==================
17:11:13.190 PlayerService reloadPipeline
 allowPlaying=true forceResume=false state after reload=1
==================
17:11:14.450 PlayerService reloadPipeline
 allowPlaying=true forceResume=false state after reload=2
==================
17:11:17.761 PlayerService onRoutingChanged
newDevice=speaker oldDevice=bt
==================
17:11:17.761 PlayerService reloadPipeline
 allowPlaying=false forceResume=false state after reload=2
 
Can I  know the culprit app or action that's send causing Poweramp to resume when the Sennheiser reconnects?
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...