1

Many of us Android users have probably already heard of Greenify – an app that can automatically hibernate apps as soon as you turn off the screen. That even works while keeping their GCM functionality working – so whenever a cloud message for them comes in, they get awake again.

Unfortunately, that wakeup only works with GCM. Now I want to hibernate a non-GCM app, but have it awaken in intervalls (eg. de-hibernate it all 30 min for 1 min, then auto-hibernate it again).

Is this possible – and if so, how?

My device is rooted, the XPosed framework is installed, and available as well – so solutions involving one or more of those criteria are perfectly welcome as well.

2

Oh well, oh my … question almost included the answer. Still needs some testing (I've just set it up now), using which has a Greenify plugin:

  • Condition:
    • Event › Display › Display Off
  • Task:
    1. Task › Wait: 20 s (just in case)
    2. Task › Anchor: (Name, optional step)
    3. Plugin › Greenify › Hibernate: Pick the app
    4. Task › Wait: 30 min (or however long you want to have the app hibernated)
    5. Plugin › Greenify › Wakeup: Pick the app again¹
    6. Task › Goto: Action Number, 2
  • Exit Task:
    • Plugin › Greenify › Wakeup: Pick the app again¹

Note: That's how I would set it up. Had to skip the exit task as Tasker won't let me add one. So that's the crux here: I have to trust Tasker to restore the "previous state" correctly. If that doesn't work, I'll have to create a second profile for Event › Display: Display On (which would, being an EVENT, fire when the display will be turned on – it's not a state) and have a single task to do what otherwise the exit task would do.

Note 2: In order for this to work, you need to add the "target app" to Greenify's hibernation list first (i.e. tell Greenify it should hibernate it when turning the display off). If you don't do that, it won't ever be hibernated at all.


¹ if your app doesn't react on the wake-up command, see Xavier's answer for an alternative shell command to try

  • 1
    @beeshyams A bug in Conversations (the "Jabber" messenger), which I use the F-Droid version of (comes without GCM). Often turns up to be the top consumer (50% and more). Before I started using that, I had a battery time of ~5 days. With it, it's 2..3 days when I'm lucky. I don't really need to react immediately if someone pings me – so I want to have it hibernated, and only check every 30min if there's something new – for which I grant it 3min currently. As I wrote, I'm not yet sure how it works – should be able to tell in a few days (will accept the answer if it does). – Izzy Jul 18 '17 at 20:29
  • 1
    @Izzy Good workaround I was in the same situation where I wanted to wake non GCM apps after hibernating them with Greenify plugin, but some wouldn't respond to the "wake up" command provided by Greenify plugin.. I will short put my workaround as answer :) – xavier_fakerat Jul 18 '17 at 20:59
  • My candidate doesn't seem to respond to the "Freeze!" command :( Was on 78% battery usage when I killed it. Crazy enough, 2h later I found Hangouts running (accounting for another 12%), which I don't use at all – I'm totally confused now. Killed and disabled it Grmpf! – Izzy Jul 19 '17 at 20:35
1

I found out some of the hibernated apps wouldn't respond to the Greenify Wake command, instead I used the start service command to "wake" the target application (without opening its UI)

Profile Context

  • Event › Display › Display Off

Task

  • Click "+" to add new Action

  • Task › Wait: any preset e.g 20s (like above)

  • Task › Anchor: (Name, optional step)

  • Plugin › Greenify › Hibernate: Pick the app

  • Task › Wait: 30 min (or however long you want to have the app hibernated)

  • Code >> Run Shell [ Command (am startservice -n com.package.name/.service name , Tick "Use Root"]

    NB: service name is just a declared service in Android manifest that starts an application without opening UI i.e in background, there are also tools to use if you're not sure of the service name)

  • Tap back to exit from this task

  • Click "+" to add another action
  • Task >> Goto [Action Number, 2 (anchor task)]

    Like @Izzy said you can rely on Tasker 'previous state' to reset the config, because adding an exit task is not probable

My workaround simply involves starting the service of the hibernated app (IMO=waking the app) because sometimes the app won't wake up using the Greenify wake option as I previously encountered :)

  • Mmm I doubt if it needs donation pack, in the meantime have you checked if secure lock is possibly interefering with greenify functionality? Found this here: Facing issues while using plugins such as greenify, autoshortcut etc – xavier_fakerat Jul 19 '17 at 20:43
  • 1
    Donation pack not needed for this functionality, correct. Trick was something else – see "Note 2" in my (updated) answer: the app must be in Greenify's "Todo List" ;) – Izzy Aug 29 '17 at 16:56
  • Yes and no. Without that restriction you've had the chance to hibernate apps under certain conditions only (e.g. only if no WiFi available, only if the battery is below a certain threshold, etc.). With this restriction, that becomes harder. But of course it's good to know this restriction exists – or you'd wonder, like me, why the profile is not working ;) – Izzy Aug 29 '17 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.