Google Play Music oversleeping

Post your questions and help other users.

Moderator: Martin

Post Reply
Micky Micky
Posts: 179
Joined: 16 Oct 2019 17:38

Google Play Music oversleeping

Post by Micky Micky » 18 Mar 2020 18:25

Hello

I'm using a time trigger and a Start Activity to play a song from Google Play music as my morning alarm.

It works when I test it with the screen off and locked.

But it doesn't work in the morning after the phone has been inactive all night.

I have switched off all battery optimizations.

Samsung S10 running Android 10.

Also, if I use the action Control Media Player instead of Start Activity, that works but I can't select the particular song using this method.

Any ideas or an alternative approach?

Many thanks

Micky
Crude but it works.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Google Play Music oversleeping

Post by Desmanto » 18 Mar 2020 20:09

I think there might be another optimization hidden from the user controlable setting. Try to crosscheck here : https://dontkillmyapp.com/samsung


If Control Media Player work, maybe the quick dirty hack is to use that, play, sleep 500ms, then pause. This should wake play music already. Then use Start Activity again, it should be working now.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Micky Micky
Posts: 179
Joined: 16 Oct 2019 17:38

Re: Google Play Music oversleeping

Post by Micky Micky » 18 Mar 2020 21:02

Hello,

Hope you're well considering the current situation.

Thanks for the link. I had done most of that but it was worth checking again. I was able to put AM workarounds app on the never put to sleep list. Although it might not be connected to this issue, it shouldn't be put to sleep IMO.

I'll try your hack approach. I did it with Launch but not Play and Pause.

Many thanks.
Crude but it works.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Google Play Music oversleeping

Post by Desmanto » 19 Mar 2020 18:22

Hi, Thanks for asking. I am fine. I hope you are fine too and also everyone. We don't have lockdown yet here, but most of companies here already running contigency plan. Hope the pandemic doesn't last long and everyone can stay safe.

If Start Activity somehow doesn't work, you can also try launch app first and then start activity. But if all not working, you might need to check if the trigger is running properly. You most likely use trigger time, try to check Allow in doze and Like alarm.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Micky Micky
Posts: 179
Joined: 16 Oct 2019 17:38

Re: Google Play Music oversleeping

Post by Micky Micky » 19 Mar 2020 21:01

Hello

Still not working.
The trigger works fine.
When I unlock the phone the song starts playing.
If I use Control Media Player with Play then a song will play.
So it seems that Start Activity is the problem.

From AM help documentation:

Tip: Some activities require special permissions to be launched. Check the log after testing the action when an activity fails to start.

Any thoughts on this?

Many thanks

Micky
Crude but it works.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Google Play Music oversleeping

Post by Desmanto » 21 Mar 2020 15:50

If after unlock the music can play, that means during sleep, start activity can't bring the app to foreground. This is general android security procedure. Using Control Audio Player send the media button to the service, which can run background.

You need to have some set action to unlock the phone first before using start activity. Or you can test it out. Try to use time trigger in the next 2-3 minutes, add some start activity with other app or play music. Lock the phone and wait for it. Do the same again, but this time don't lock the phone.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Micky Micky
Posts: 179
Joined: 16 Oct 2019 17:38

Re: Google Play Music oversleeping

Post by Micky Micky » 21 Mar 2020 18:37

Hello,

Firstly, in my original post I stated that during testing it worked. I think this was because GPM was still in the background.

It seems you were thinking along the right lines. The phone needed to be woken up, not necessarily unlocked. I've added the action TURN SCREEN ON and it works. Without this it doesn't.

Now to see whether it works in the morning after a night's sleep.

Many thanks,

Micky
Crude but it works.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Google Play Music oversleeping

Post by Desmanto » 22 Mar 2020 17:47

Oh, I forgot it you said it is working if tested immediately. Then it will be issue with the power save or doze mode. Turn screen on seems to wake it up properly.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Micky Micky
Posts: 179
Joined: 16 Oct 2019 17:38

Re: Google Play Music oversleeping

Post by Micky Micky » 27 Mar 2020 21:45

Hello

It worked the next morning!

And hasn't since.

I've been too busy to do anything more but I have plenty of time now with the lockdown.

Many thanks
Crude but it works.

Post Reply