M Mike1970 Well-Known Member Licensed User Longtime User May 27, 2019 #1 Hi, i'm working with the gps, and i was wondering if there is a way to detect when the gps is toggled off by the user, so i can show a msgbox (or a notfication) to say to enable the gps again
Hi, i'm working with the gps, and i was wondering if there is a way to detect when the gps is toggled off by the user, so i can show a msgbox (or a notfication) to say to enable the gps again
Erel B4X founder Staff member Licensed User Longtime User May 27, 2019 #2 Yes. Handle the UserEnabled event. Upvote 0
M Mike1970 Well-Known Member Licensed User Longtime User May 27, 2019 #3 Erel said: Yes. Handle the UserEnabled event. Click to expand... I put this event in the Tracker Service of this tutorial: https://www.b4x.com/android/forum/threads/background-location-tracking.99873/ I wrote: B4X: Sub GPS_UserEnabled (Enabled As Boolean) If Enabled == False Then Msgbox("Enable the gps", "GPS Off") End If End Sub But it give me this error: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application Upvote 0
Erel said: Yes. Handle the UserEnabled event. Click to expand... I put this event in the Tracker Service of this tutorial: https://www.b4x.com/android/forum/threads/background-location-tracking.99873/ I wrote: B4X: Sub GPS_UserEnabled (Enabled As Boolean) If Enabled == False Then Msgbox("Enable the gps", "GPS Off") End If End Sub But it give me this error: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
Erel B4X founder Staff member Licensed User Longtime User May 27, 2019 #4 1. Never use Msgbox. Only MsgboxAsync. 2. You cannot show any UI other than toast messages from services. You can start an activity. Upvote 0
1. Never use Msgbox. Only MsgboxAsync. 2. You cannot show any UI other than toast messages from services. You can start an activity.
M Mike1970 Well-Known Member Licensed User Longtime User May 27, 2019 #5 Erel said: 2. You cannot show any UI other than toast messages from services. Click to expand... Interesting, thanks Erel! Upvote 0
Erel said: 2. You cannot show any UI other than toast messages from services. Click to expand... Interesting, thanks Erel!