6

My app does not receive ACTION_SCREEN_ON or ACTION_USER_PRESENT on Android O device after device remains idle for some time. My app has widgets. I update those widgets with data from backend when the user unlocks the phone. This functionality has been working when I am targetting SDK 25. Now I am compiling the app with target SDK 26. I converted the service that gets data for widgets to JobService. Everythings works fine when the user adds the widget to the home screen. Then if I kill the app and turn off the screen and say after 5 minutes if I unlock my phone, my app receives ACTION_SCREEN_ON and ACTION_USER_PRESENT intent I am able to start the service and update data on the widget. However, If I leave device idle for a couple of hours and then when I unlock the screen, the application does not receive ACTION_SCREEN_ON and ACTION_USER_PRESENT intent. Is this due to Android O limitations on implicit intents. If so how have you solved the problem? If not then what method has worked for you?

Yogesh
  • 71
  • 5
  • "Is this due to Android O limitations on implicit intents" -- most likely, as I do not see them on [the whitelist](https://developer.android.com/guide/components/broadcast-exceptions.html). – CommonsWare Mar 19 '18 at 20:49
  • But then it does not explain....app receiving intents even after I have killed the app for first 5 to 10 minutes. Updating widget on "screen on" is probably the common pattern. What would be the solution? – Yogesh Mar 19 '18 at 20:57
  • Other than doing the work periodically, rather than based on those specific events, I do not have a solution for you. I also cannot explain the difference in the implicit `Intent` behavior that you are seeing. IMHO, they should have those two broadcasts on the whitelist. – CommonsWare Mar 19 '18 at 20:59
  • 1
    Did you find any solution to this problem. I'm also facing similar issue. I want to update my app widget whenever the user unlocks his device. – Muhammad Mehdi Raza Jul 02 '18 at 08:11
  • Looking for a solution too. It works for a while, but then stops. – c0dehunter Sep 18 '18 at 09:35
  • What solutions brothers? – nicolas asinovich Jan 21 '19 at 10:01

0 Answers0