Update widget on Android O
Asked Answered
G

0

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?

Grani answered 19/3, 2018 at 20:42 Comment(6)
"Is this due to Android O limitations on implicit intents" -- most likely, as I do not see them on the whitelist.Wrongly
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?Grani
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.Wrongly
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.Radiative
Looking for a solution too. It works for a while, but then stops.Binetta
What solutions brothers?Disulfide

© 2022 - 2024 — McMap. All rights reserved.