Android Question Clear Cache of GPS location Update

AndroidMadhu

Active Member
Licensed User
Hello,
I am facing one issue is that , if GPS Turn OFF, the position is activated and I must have to clear cache for reset.
As when the internet is OFF, then I am turning OFF the GPS.
But when I am making the Internet available [ON] then all the GPS data coming that has been stored in GPS cache during Internet Unavailability.
Below is the code base where I am turning OFF the GPS service....

B4X:
Sub PhoneEvent_ConnectivityChanged(NetworkType As String, State As String, Intent As Intent)
     
'NetworkType - WIFI or MOBILE.
'State - One of the following values: CONNECTING, CONNECTED, SUSPENDED, DISCONNECTING, DISCONNECTED, UNKNOWN.
     
If State = "CONNECTED" Then
If gmap.IsInitialized Then
Tracker.GPS.Start(gmap.MyLocation.Latitude,gmap.MyLocation.Longitude)
End If
internetConnectionStatus(False,"")
Starter.internet_connected=True
Try
'Starter.mqtt.Initialize("mqtt", Starter.serverURI, Rnd(0, 999999999) & DateTime.Now)
Dim mo As MqttConnectOptions
mo.Initialize("xxx", "xxx")
Starter.mqtt.Connect2(mo)
Log("mqtt_init")
Starter.mqttConnected=True
Catch
Log("MQTT / " & LastException)
End Try
Else
internetConnectionStatus(True,"No Internet. Connect Wi-Fi or Mobile Network")
Tracker.GPS.Stop
Starter.internet_connected=False
Starter.mqttConnected=False
End If
     
End Sub




Could you please advice as how to clear the GPS cache when the internet is not available.

Thanks
 

AndroidMadhu

Active Member
Licensed User
There is no GPS cache
Ok... But the strange thing is when my internet connection is restoring from DEAD to ALIVE.... all the GPS data [lat/Long] throwing to MQTT at once[The time when the Internet was DEAD].. and MQTT is going to Buffer mode... [Unless I make CTRL+X] to exit and restart the MQTT broker.

Am I doing any mistake.......

Please advice..

Thanks
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…