Android Question GPS is started or not

Scantech

Well-Known Member
Licensed User
Longtime User
Hello,

How can i know if the GPS is started or not? I know GPS1.GPSEnabled is for location turned on or off but i like to find out if it is started.
 

emexes

Expert
Licensed User
Hmm. Good question. If you are receiving location callbacks, that'd be a start. Or perhaps properties like these:

upload_2019-8-2_2-51-58.png


upload_2019-8-2_2-52-13.png


That UsedInFix property looks promising too - just because the GPS can see a satellite and give you a SNR, doesn't mean it's yet got valid fixes.
 
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
B4X:
Sub GPS_LocationChanged (Location1 As Location)
    locationGPS = Location1
End Sub

That did not work.

The value is true when GPS1.Start(0, 0) and also the value is true when GPS1.Stop.

There is got to be a way.
 
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
I guess this is the only way as per Erel example
B4X:
Public Sub StartGps
    If gpsStarted = False Then
        GPS1.Start(0, 0)
        gpsStarted = True
    End If
End Sub
Public Sub StopGps
    If gpsStarted Then
        GPS1.Stop
        gpsStarted = False
    End If
End Sub
 
Upvote 0
Top