How to check enabled/disabled status for apps?

Post your questions and help other users.

Moderator: Martin

Post Reply
viorel.rusu
Posts: 19
Joined: 20 Jul 2016 09:32

How to check enabled/disabled status for apps?

Post by viorel.rusu » 27 Jul 2016 09:28

Hi everybody,

I have an LG G3 Andoid 6 - rooted.
I want to make a flow for Waze to freeze it/unfreeze it (using Execute root comand: pm enable / disable) but I want to check it's status (if is enabled/unfreezed or disabled/freezed in that moment).
It's a method for that?

Thank you!

User avatar
Bushmills
Posts: 286
Joined: 23 Sep 2014 21:56

Re: How to check enabled/disabled status for apps?

Post by Bushmills » 27 Jul 2016 10:50

I'd not bother. If you want it disabled, you want it disabled regardless of current state. Therefore just disable it. Disabling an already disabled package is fine, and doesn't produce an error. Same is true for enabling.
if you really need to know, pm dump <package> can produce that information, through a line containing "enabled=1" or "enabled=2" for enabled and disabled.

viorel.rusu
Posts: 19
Joined: 20 Jul 2016 09:32

Re: How to check enabled/disabled status for apps?

Post by viorel.rusu » 27 Jul 2016 11:45

Bushmills wrote:I'd not bother. If you want it disabled, you want it disabled regardless of current state. Therefore just disable it. Disabling an already disabled package is fine, and doesn't produce an error. Same is true for enabling.
if you really need to know, pm dump <package> can produce that information, through a line containing "enabled=1" or "enabled=2" for enabled and disabled.
Like your first replay (edited now), your answers are useless. Incomplete, generic, patronizing.
Please don't bother to write in this topic again.
If there are users with knowledge and common sense I will receive an clear answer from them.

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: How to check enabled/disabled status for apps?

Post by MURTUMA » 27 Jul 2016 13:10

Bushmills wrote:Have you considered consulting a doctor who can help you with your affliction?
You might want to reconsider, before giving this kind of comments here from now on. Lets keep things either civilized or out of here.

viorel.rusu wrote:Like your first replay (edited now), your answers are useless. Incomplete, generic, patronizing
How that answer is useless or incomplete? Or what kind of specifics you'd like to have, so the answer wouldn't be generic? That actually is a valid answer, so keep that kind of accusations out of here and use only the report tool instead, if something bothers you.


Are we settled?

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: How to check enabled/disabled status for apps?

Post by MURTUMA » 27 Jul 2016 14:04

I can't lock this topic, because the case can still be considered open and making a new topic won't serve any further purpose, but I will keep deleting any off-topic comments from here.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: How to check enabled/disabled status for apps?

Post by Martin » 28 Jul 2016 19:00

Hi,

You could use action Init Variable Package Info (options all unchecked) to get some basic information about the app. The structure application_info contains a flag "enabled" that should be true/false depending on the state of the app.

A flow could look like this:
-...
-action Init Variable Package Info: your.app
-condition Expression: package_info["your.app"]["application_info"]["enabled"]
--> true: -actions ...
--> false: -actions ...


If you're interested to see the output stored in the variable package_info, I recommend following procedure:
-action Init Variable Package Info: your.app
-action Script: text = toJSON(package_info);
-condition Debug Dialog

Click the line with the variable text in the debug dialog and use Show value in text editor to see the JSON representation of the result.
Maybe I'll include an option like Show as JSON in the debug dialog in a future version, since this would simplify debugging such stuff quite a lot.

Regards,
Martin

viorel.rusu
Posts: 19
Joined: 20 Jul 2016 09:32

Re: How to check enabled/disabled status for apps?

Post by viorel.rusu » 29 Jul 2016 07:26

Martin wrote:Hi,

You could use action Init Variable Package Info (options all unchecked) to get some basic information about the app. The structure application_info contains a flag "enabled" that should be true/false depending on the state of the app.

A flow could look like this:
-...
-action Init Variable Package Info: your.app
-condition Expression: package_info["your.app"]["application_info"]["enabled"]
--> true: -actions ...
--> false: -actions ...


If you're interested to see the output stored in the variable package_info, I recommend following procedure:
-action Init Variable Package Info: your.app
-action Script: text = toJSON(package_info);
-condition Debug Dialog

Click the line with the variable text in the debug dialog and use Show value in text editor to see the JSON representation of the result.
Maybe I'll include an option like Show as JSON in the debug dialog in a future version, since this would simplify debugging such stuff quite a lot.

Regards,
Martin
Thank you, Martin!

Post Reply