Hello,
I have an app that includes a widget. In the widget service module I set a value in a file to 1 when the widget is created and set the value to 0 when the widget is disabled.
But the disabled event is never called. I uninstalled an installed new several times to see if some "ghost" widgets where causing the problem, but it still acts like this. The event is never called, I cheked it with a log().
Is there no way to determine by some OS stuff if the widget is currently on the homescreen or not??? Seems a bit strange that the only way to determine this is by a file entry. My widget updates several times a day, so that would be a lot of power wasted if it wanst on the screen. Is there a complete documentation on the widget? I only found the two tutorials.
I have an app that includes a widget. In the widget service module I set a value in a file to 1 when the widget is created and set the value to 0 when the widget is disabled.
But the disabled event is never called. I uninstalled an installed new several times to see if some "ghost" widgets where causing the problem, but it still acts like this. The event is never called, I cheked it with a log().
Is there no way to determine by some OS stuff if the widget is currently on the homescreen or not??? Seems a bit strange that the only way to determine this is by a file entry. My widget updates several times a day, so that would be a lot of power wasted if it wanst on the screen. Is there a complete documentation on the widget? I only found the two tutorials.
B4X:
Sub Service_Create
file.write(file.dirinternal, "widgeton.txt", "1")
wid = ConfigureHomeWidget("mywidget", "wid", 0, "some label", True)
Log("SETWIDGET")
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_Destroy
End Sub
Sub wid_RequestUpdate
wid.UpdateWidget
End Sub
Sub wid_Disabled
Log("DISABLE") '<------- Never done
file.write(file.dirinternal, "widgeton.txt", "0")
StopService("")
End Sub