I have an app that uses the GPS.
My problem is that when I get to the part that the GPS is looking for a signal and cant find it, it just keeps on searching. This kills the battery.
I used this:
this.locationManager.requestLocationUpdates(this.provider, 0,
0, pendingIntent);
but it only sets the refresh rate. If the GPS is not locked than it keeps on trying.
I want it to stop after a few minutes of trying to get a lock.
What can I do?
If you want to not check for new location frequently you have to specify minimum time and minimum distance. the structure is like this :
for more information check this link : http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates%28java.lang.String,%20long,%20float,%20android.app.PendingIntent%29
Edit : Sorry i don't understood your question. check this link, what you have to do is to set a timeout. Hope this help . How to time out GPS signal acquisition