Hibernate apps, but have them wake up periodically for a short time 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 tasker available as well – so solutions involving one or more of those criteria are perfectly welcome as well.
Oh well, oh my … question almost included the answer. Still needs some testing (I've just set it up now), using tasker which has a Greenify plugin:


  
  Condition:
  
  
  Event › Display › Display Off
  
  Task:
  
  
  Task › Wait: 20 s (just in case)
  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)
  Plugin › Greenify › Wakeup: Pick the app again¹
  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