Suppose a widget needs updating itself on specific times (top of the hour, midnight, etc....), then
is this the proper logic for it? Especially the rv_RequestUpdate in Service_Start ???
is this the proper logic for it? Especially the rv_RequestUpdate in Service_Start ???
B4X:
Sub Process_Globals
Dim rv As RemoteViews
End Sub
Sub Service_Create
rv = ConfigureHomeWidget("layout", "rv", 0, "My Wid",True)
End Sub
Sub Service_Start (StartingIntent As Intent)
If rv.HandleWidgetEvents(StartingIntent) Then Return
rv_RequestUpdate '<--- need this to update widget when service wakes up
End Sub
Sub rv_RequestUpdate
' update widget remote views
rv.SetText(....
rv.UpdateWidget
Dim nxt as Long
' compute next time service should wake up
nxt=........
StopService("")
StartServiceAt("",nxt,False)
End Sub
Sub rv_Disabled
StopService("")
CancelScheduledService("")
End Sub
Sub Service_Destroy
End Sub