Android Question [RESOLVED] Andoird 8.0+ Widgets Update not occuring when widget receives a broadcast intent

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hi

We have a widget, works great until Android 8.0+.

Couple of things:

1. The widget service is using BroadcastReceiver Library so it can receive intents from the associated app and update the widget display.
2. The widget display is 3x1, all images.
3. Under Android 8.0+ the widget service is killed because I have to use Service.StopAutomaticForeground in the Service_Start so I dont get an notification icon displayed.
4. When I receive an intent from the app, I set the rv.setImage and request an update.
5. When the widget service is destroyed, I call StartServiceAt(Me, DateTime.Now + 1000, False) from the Service_Destroy, when the service
restarts, it will make request to the app for it current state, the state values are received via intents and the widget will then update.

Anyone got any ideas or tips using Widgets under Android 8.0+

Regards

John.
 

DonManfred

Expert
Licensed User
Longtime User
DateTime.Now + 1000
Android (at least high versions) does not allow you to restart a service in such short interval.
Set it to 15 minutes minimum. I dont know exactly. Maybe you need to use 30
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
Android (at least high versions) does not allow you to restart a service in such short interval.
Set it to 15 minutes minimum. I dont know exactly. Maybe you need to use 30

Not really addressing the update issue. I can live with service restarting, if there a better way of doing widgets in B4X ?
 
Upvote 0
Top