Getting a background service to display message box

Azhar

Active Member
Licensed User
Longtime User
Hi

I need to get my service to display a msgbox2 type prompt window but I get a fatal error as it seems I cannot do this from a service (only an activity).

If this is the case and a service cannot prompt the user for some Yes/No type input, then is there a workaround?

I would like the service to prompt the user after a specified period of time to switch to GPS for a location fix if GSM network is unavailable.

Many thanks,

Azhar

Actual Error is: Unable to Add Window... is your activity running?
 

NJDude

Expert
Licensed User
Longtime User
You will have to use CallSubDelayed.

For example, in your Main activity (or any other) create a sub where the MsgBox will display, then on the service when the error occurs do sometinhg like:
B4X:
CallSubDelayed(Main, "SubToDisplayMsgBox")
 
Upvote 0
Top