0

I have this app , forcedoze which enforces better doze for extra battery saving. I want to enable / disable it on schedule for which I see broadcast for Tasker

com.suyashsrijan.forcedoze.ENABLE_FORCEDOZE

(Broadcast values required : None)

And a similar one with DISABLE

How do I use this in Macrodroid? Guess I need to use intents but am clueless on this, not having used it and it looks complicated - am not sure what to fill in multiple options ( if my guess is correct )

beeshyams
  • 40,739
  • 30
  • 119
  • 269

1 Answers1

1

My solution requires sending the intents with superuser (root) privilege and unfortunately, the Send Intent action in MacroDroid does not permit that. So I've used the Script action of MacroDroid as a workaround.

Sending a broadcast (it is universal, not Tasker specific) alone would not do anything here. Using the logcat, I noticed that the app starts the service named ForceDozeService and then issues the relevant broadcast.

Script (en.sh) to enable the ForceDoze:

#!/system/bin/sh

su -c 'am startservice com.suyashsrijan.forcedoze/.ForceDozeService' 
su -c 'am broadcast -a com.suyashsrijan.forcedoze.ENABLE_FORCEDOZE -n com.suyashsrijan.forcedoze/.EnableForceDozeService'

Script (ds.sh) to disable the ForceDoze:

#!/system/bin/sh

su -c 'am stopservice com.suyashsrijan.forcedoze/.ForceDozeService' 
su -c 'am broadcast -a com.suyashsrijan.forcedoze.DISABLE_FORCEDOZE -n com.suyashsrijan.forcedoze/.DisableForceDozeService'

Use the action Script in Macrodroid as:

sh FILE_PATH      // such as /sdcard/en.sh

That should work.

Firelord
  • 25,084
  • 20
  • 124
  • 286
  • With mere logic. you can actually reduce this to one single script and reduce the redundancy I added in superuser privilege. I would have done that myself, but I'm short on time now. – Firelord May 21 '17 at 18:10
  • Thanks for the solution and prompt revert. Will try this later. and revert if any issues - though I am sure it would work. Thanks again – beeshyams May 21 '17 at 23:39