Android Question Widget

Fulvio75

Well-Known Member
Licensed User
Hello,
I have a problem with the widget, I followed your tutorial and copied the code to create my widget, but sometimes when I try to open my app with the widget displayed on the phone the application does not start and remains black phone screen.
To allow the application to start I have to flip the widget from the screen empty the phone cache and restart the application, in this way it starts.
If I put the widget on the display the first time the application is restarted, it starts then closing it and reopening it opens the black screen.
The situation improves if I put in the code:
B4X:
Sub Service_Start (StartingIntent As Intent)

If RV.HandleWidgetEvents (StartingIntent) Then Return
Sleep (0)
Service.StopAutomaticForeground

End Sub
lines

B4X:
Sleep (0)
Service.StopAutomaticForeground
the problem occurs more rarely, you can give me some help
Thank you
 

Fulvio75

Well-Known Member
Licensed User
Thanks, the right code is:
B4X:
Sub Service_Start (StartingIntent As Intent)
    
    RV.HandleWidgetEvents(StartingIntent)
    Sleep(0)
    Service.StopAutomaticForeground
    
End Sub

Sub RV_RequestUpdate
    
    LoadWidgetData
    RV.UpdateWidget
    
End Sub

this is right?
 
Upvote 0
Top