androidservicegpslocationlistener

How to wait for a GPS fix before recording location


I am having trouble finding an approach to wait for a GPS fix in my Android application. I am running a service to record user location and want to wait for a GPS fix before I do so. Can anyone suggest a method for approaching this?


Solution

  • Just get a locationManager and request location update for GPS. Do not call getLastKnownLocation. When you get the onLocationChanged() that is your GPS fixed.