5

What is Google's definition of a user "actively using" an app, in the context of app widgets? If an app hasn't been opened for a long period of time but has a widget on the home screen, does anybody know if Android will put that app in standby mode? From the documentation, it seems like app widgets would fit into this description: "The app has a process currently in the foreground (either as an activity or foreground service, or in use by another activity or foreground service)." But I'm not quite sure.

Thoughts?

https://developer.android.com/preview/features/power-mgmt.html

dennisdrew
  • 4,399
  • 1
  • 25
  • 25
  • 2
    Good question. I'd expect that if you use the 'standard' way of updating the widget - by specifying the update interval in the widget's config xml - then the system will invoke your Broadcast Receiver associated with your widget correctly, even if the app itself is in stand-by mode. No idea how this will affect widgets that are updated in a custom manner (e.g. setting the update interval to 0 and scheduling updates via AlarmManager). – Zsombor Erdődy-Nagy Sep 14 '15 at 13:08

1 Answers1

3

I followed the testing steps at the link you referenced and believe i have verified that if your app has an app widget added anywhere, your app will not be put in stand by mode. When I added my app's app widget to a launcher, and ran these commands back to back:

$ adb shell am set-inactive <packageName> false
$ adb shell am get-inactive <packageName>

the system reported:

Idle=false

This was even the case if the app widget was added to a stopped launcher that wasn't set to be my main launcher in the system settings. When I removed the app widget and ran the same commands the system reported:

Idle=true

I believe (have not verified) that when an app requests that widget be added, the system is made aware that a widget from your package is added somewhere and thus the system won't put your app in standby mode.

Shep Shapard
  • 148
  • 8