1
Solved

Profiles not working on Xiaomi MIA1 Android PIE 9.0 when screen is locked

Hello, i'm using tasker for several years now for some routine scripts (launch music player when bluetooth headset is connected then launch music, send domoticz commands when i come home, that kind of things).

I updated my phone (Xiaomi MIA1) to Android 9.0 friday night and now tasker is not able to activate any profile at all.

The app is of course removed from battery optimization and is always running. I activated all permissions and accessibility either.

I tried uninstalling and reinstalling and it did nothing.

If i test the profiles one by one it works correctly.

Thanks.

6 replies

Good news ! Setting Spotify not battery optimized seems to do the trick. But I don't understand, my profile is set to always start a new copy, it's not working, do you know why ? (I'm curious).

Also, I'll do some tests in the week and tell you if it's indeed that this week end.

Glad to know :)

About the new copy, Spotify may be storing its state in a way that Tasker can't control.

Hello João, it's not working either with the toggle pause command :(

Maybe it's Spotify that's being battery optimized?

Hello João I made some tests and here is what I found : 

If the screen is on everything runs normally.

If the screen is off and the phone unlocked everything runs normally as well.

But if my screen is off and the phone is locked, Spotify is launched and nothing happens, when I try to unlock my screen it dontd unlock it and it's buggy (I got my screen like i'm switching between 2 apps and got to it the home menu to be able to do anything.)

However, I took some logs and looked at it and I don't see anything bad in it, you can find them at this link : Tasker logs.

For those logs my test scenario was :

My screen is off and locked, I start my Bluetooth device. Wait until spotify play the music (I waited ~ 10-15s and it never played). Shut down the device.

Obviously one more time for privacy reasons I replaced all the sensitive informations in the logs by xxxxx.

I hope it'll help you to find what the hell is happening as I don't have any idea :(

Thanks.

Thanks. Since when you unlock your phone the Spotify app is open, it means that Tasker is running the task correctly, but Spotify is not responding correctly.

Does it work if you use the Play/Pause action instead of the Play one?

Hello João, it's indeed working perfectly with the screen unlocked.

I removed the Bluetooth address but it didn't changed anything.

In fact it seems that Tasker try to launch spotify and for some reason it crash at starting when the screen is locked.

Can you check Tasker's run log when that happens? Maybe it says why it's failing there?

Can you please export your profile's description (not xml) so I can take a look? Long-click the profile in Tasker->export description Thanks in advance

Also, did you check out the https://dontkillmyapp.com/ instructions as well?

Hello , i checked https://dontkillmyapp.com/ instructions and eveything is good for me.

Here are the 2 profiles export, for obvious reasons i hid sensitive informations :

first :

Profile: Music (6)
    State: BT Connected [ Name:PLT BB PRO 2/MEIZU EP52 Address:XX:XX:XX:XX:XX:XX/XX:XX:XX:XX:XX:XX ]
    Enter: Music On (2)
    A1: Launch App [ App:Spotify Data: Exclude From Recent Apps:On Always Start New Copy:On ] 
    A2: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ] 
    A3: Media Volume [ Level:15 Display:Off Sound:Off ] 
    A4: Media Control [ Cmd:Play [Simulated Only] Simulate Media Button:On App:Spotify ] 
    
    Exit: Music Off (3)
    A1: Kill App [ App:Spotify Use Root:Off ] 
    A2: Media Volume [ Level:0 Display:Off Sound:Off ]

second: 

Profile: At Home (14)
    State: Wifi Near [ SSID:XXX_XXX MAC:XX:XX:XX:XX:XX:XX Capabilities:* Min. Activate Signal Level:6 Channel:0 Toggle Wifi:Off ]
    Time:  Every 9m
    Enter: Set Presence On (15)
    A1: WiFi [ Set:On ] If [ %WIFI ~ Off ]
    A2: Wait [ MS:0 Seconds:30 Minutes:0 Hours:0 Days:0 ] 
    A3: HTTP Get [ Server:Port:192.168.0.10:8080 Path:json.htm?type=command&param=switchlight&idx=17&switchcmd=On Attributes: Cookies: User Agent: Timeout:10 Mime Type: Output File: Trust Any Certificate:Off ]

Thank you. To confirm, it works correctly if the screen is on?

Can you try not setting a BT address in the state and see if that works?

Hi there.
To make sure Tasker and the AutoApps run in the foreground please check here: https://tasker.joaoapps.com/userguide/en/faqs/faq-problem.html#00

Hope this helps!

Hello  and thank you for your answer, unfortunately i did check the FAQ before posting here and it's not working either with all these options activated.

I got logs if you want to check on it. The real strange part is apparently the task is done properly but it keeps looping and can't seems to be able to open spotify :(

Sometimes however, the task launch the app without problem but it's 1 out of 10.

I got another task sending a http request to a server every 10 minutes and it's not working anymore either (never this one).

Topic is closed for comments