Determine if a specific app is running?

Post your questions and help other users.

Moderator: Martin

Post Reply
Econdoc
Posts: 153
Joined: 28 May 2016 20:06

Determine if a specific app is running?

Post by Econdoc » 31 May 2019 00:32

I would like to turn on DATA when Android Auto starts. Android Auto starts by itself when the USB cable is plugged into the car USB port. I normally keep data off, but would like to have it turn on by itself when I plug in the phone in the car.

I can write the script to toggle data on without any problem. I just cannot figure out how to know when Android Auto is running.
Any ideas?

Pepy
Posts: 76
Joined: 31 Oct 2018 10:53
Location: Canada

Re: Determine if a specific app is running?

Post by Pepy » 01 Jun 2019 02:35

I've never tried the app for myself before but shouldn't the App Task Started trigger be enough?
Hope my post was helpful :D
Device: OnePlus 5T running crDroid, rooted with Magisk 8-)

Econdoc
Posts: 153
Joined: 28 May 2016 20:06

Re: Determine if a specific app is running?

Post by Econdoc » 01 Jun 2019 17:34

It would seem that that should work. Sadly it does not.

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

Re: Determine if a specific app is running?

Post by Desmanto » 01 Jun 2019 19:27

App Task Started using classic method, require accessibility services to be running. Try to check if the Automagic Accessibility is enabled already. If yes, try to toggle it off and on again. Sometimes the OS kill the service, but Automagic report it is still enabled (happens when you use "nuke button" kill all from the recents menu). Try the Usage statistic method too, make sure Automagic has been granted Usage Statistic.
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.

Econdoc
Posts: 153
Joined: 28 May 2016 20:06

Re: Determine if a specific app is running?

Post by Econdoc » 01 Jun 2019 20:45

Trying to follow your instructions, Desmanto. What and where are Usage statistics?

Pepy
Posts: 76
Joined: 31 Oct 2018 10:53
Location: Canada

Re: Determine if a specific app is running?

Post by Pepy » 01 Jun 2019 22:44

@Econdoc, usage statistics is an alternative method the App Task Running trigger uses to determine which apps have been used last. You can enable it from Settings > Apps & notifications > Special app access > Usage access > Automagic Premium.
Hope my post was helpful :D
Device: OnePlus 5T running crDroid, rooted with Magisk 8-)

Econdoc
Posts: 153
Joined: 28 May 2016 20:06

Re: Determine if a specific app is running?

Post by Econdoc » 02 Jun 2019 11:14

Usage access seemed to to the trick.
Thanks as always.

Post Reply