Android Question GPS no more working....

tigrot

Well-Known Member
Licensed User
Longtime User
Hi everybody,
we are testing our new APP, which gets GPS fixes every 10 minutes, to do that, we take the GPS off for 8 minutes and then on for the remaining 2 minutes then we take the fix. This is to save battery.
The app works very well, but sometimes the GPS seems to hang waiting for a fix, with the little notify icon blinking also with a wide sky view. Resetting the phone corrects the issue.
Also activating Google Maps seems to reset the GPS.
Did anybody have the same issue? Seems that sometimes the GPS needs to be reset. This happens also on personal trackers, which have a special comand to reset the GPS chip to a working state.
I have not found a reset command in the libraries.

Thank you
Mauro
 

smartdispatch

Member
Licensed User
Longtime User
We have had the same issue as well that I brought up in a thread a few weeks ago. Mine went unresolved as there is nothing in the library top reset the gps. The activity resume features do to not work after the 8 to 10 minutes. This also is only occurring intermittently.
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Thank you. I'm looking for a call in Android to revitalize the GPS chip. I'll let you know if the issue is solved. The most nice thing is that we have a phone which hangs frequently, so we could test very well.
Did you have a workaround for this issue?

Mauro
 
Upvote 0

smartdispatch

Member
Licensed User
Longtime User
Mauro,

That is exactly what is happening to me right now. We went for a several weeks with no issue and then all of a sudden 1 or 2 devices start acting weird. Right now it is happening to a few devices every minutes, others it happens once and hasnt showed up again.

Jason
 
Upvote 0

smartdispatch

Member
Licensed User
Longtime User
The current bypass my employees are using that works each time is the following:

1. Reboot the devices

OR

2. Go to Task Manager >> Kill applications, then force the applications to stop running.

***********************

The other thing to try is turning the screen off by pressing the physical "Lock" button on the tablet "ON & OFF" several times. Then after a few seconds GPS coordinates start firing again.

This is definitely not an idea situation, but if you do have a workaround that can be coded into the B4A application, I would greatly appreciate any help.
 
Upvote 0

smartdispatch

Member
Licensed User
Longtime User
Mauro,

Would it be possible to share the workaround you are currently looking into? If you have any leads, I would like to help research as well. I have tried a few other methods to keep that GPS going.

But from what I can tell, the coordinates stop changing after a certain duration of time. These are not the exact coordinates but

32.716469,-117.223311
32.716469,-117.223311
32.716469,-117.223311
32.716469,-117.223311
32.716469,-117.223311

Endlessly repeating even though they are miles away from the last time the coordinate changed.

Jason
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
There is no API that resets the GPS. Make sure to only initialize the GPS object once and call Stop after the GPS was started.

I don't understand this statement. (call stop after finisihed using the GPS?) Sorry for my ignorance.
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Hi Erel, I do call Initialize once. But to save battery I need to stop the GPS. As I told I put the GPS off for 8 minutes and then on for 2 minutes(enough for a warm start, which takes less than 10 seconds). This works very well on many devices. I have some of them doing this task for two weeks without interruption. But in some of them fix is never sent to device, after some hour of work. I have experienced this issue in small personal trackers, with SIRFIII. They have a SMS comand to restart the GPS chip. They force a reboot of the chip's registers.
I have noticed that if the small GPS target icon blinks for a very long time(for ever...), if you start another GPS client, like Google Maps, the GPS restarts again. This happens without terminating App or rebooting the smartphone.
Happy Easter everybody!
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Try this workaround, seems to help, but since the problem is not reproduceble ad-libitum(classic studies background...), pls gimme a feedback when you can.
I have the GPS/Network position logic in a service. Most of the work is done by ESLocation library you can compare the results with a previous sample. If the values don't change for, say, 30 minutes there is something wrong. Then you can schedule a service startup(StartServiceAt..) after a few seconds and terminate the service. Hope that this is the way to handle this nasty problem...
Happy Easter!
Mauro
 
Upvote 0

smartdispatch

Member
Licensed User
Longtime User
Mauro,

Happy belated easter, we took a similar approach earlier this week. We ended up created a service for the GPS alone. With our we start and stop the service every 3 seconds. It seemed to have taken care of the issue for us, as we are going on 5 days with zero problems. Thanks for your help!

Jason
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Happy that my 5 cents of help solved your issue(at least hope it did). I spent most of my life solving other persons' problems. I worked on industrial plants, informatic procedures and other tech issues. I was well know as "Diagnostic Man" I traveled all Italy round when computer were big and young! Great time !
Ciao!
Mauro
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Here is the code is use for GPS handling with ESLOCATION, plus maxspeed handling.

B4X:
#Region  Service Attributes
    #StartAtBoot: False
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim GPS1 As ESLocation2
    Dim gpsc As GPS
    Dim gpson As Boolean
    Dim velocitax As Int
    Dim velocitadbl As Double
End Sub
Sub Service_Create
    gpsc.Initialize("GPSC")
    GPS1.Initialize("")
End Sub

Sub Service_Start (StartingIntent As Intent)

End Sub

Sub Service_Destroy

End Sub
Sub GPSC_LocationChanged(Location1 As Location)
      velocitadbl=Location1.speed*3.6
      velocitadbl=velocitadbl*.514444
      velocitax=velocitadbl
      If velocitax> Mioangelo.velocita Then Mioangelo.velocita=velocitax ' archivia il nuovo massimo
End Sub
Public Sub startGPS
Log("GpsON")
If gpson=False Then
  If gpsc.GPSEnabled = False Then
        GPS1.requestNetworkLocation(0,0)
    Else
        GPS1.requestNetworkLocation(0,0)
        GPS1.requestGPSLocation(0,0)
        gpsc.Start(0,0)
  End If
  gpson=True
End If
End Sub
Sub stopGPS
  Log("GpsStop")
  If gpson=True Then
    gpsc.Stop
      GPS1.stopGPSListening
    GPS1.stopNetworkListening
    gpson=False
  End If
  CancelScheduledService("")
  StopService("")
End Sub

Mioangelo is another Service. In this code I assume that both GPS and network localization are enabled in system.

Calling CallSubDelayed("GPSdriver","startGPS") does the startup
Calling CallSubDelayed("GPSdriver","stopGPS") stops the GPS and destroys the service.

Ciao
Mauro
 
Upvote 0
Top