4

Hi
I have an Android service using the location manager :

if(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
Log.i("service","start with GPS"); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,locationListener);
}

Then the location listener :

private LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location aLocation) {
Log.i("location listener", "location updated");
}
... other methods ....
}

In the manifest, the authorization for ACCESS_FINE_LOCATION is set.

Everything works ok both in simulator and phone ( Xperia Android 1.6 to 2.2 ) for NETWORK_PROVIDER. It works fine in simulator for GPS_PROVIDER. But when I try to use the GPS in the devices, the location listener is never called. I can see in the DDMS that the GPS is actually working and retrieve locations, but it never calls the listener methods. There is a strange message though :

WARN/libloc_api(1173): loc_eng_report_position: ignore position report when session status = 1

I can not see what I am missing. Any idea ? Thanks.

user244129
  • 642
  • 1
  • 8
  • 15
  • How long do you wait for position fix ? Is the GPS icon animating or still? – Reno Mar 17 '11 at 11:39
  • Well, I wait for a minute or 2, but in the log in DDMS, I see that the GPS is finding positions, as it reports lat/lng. How long is it suppose to take ? – user244129 Mar 17 '11 at 13:45
  • 1 to 15 minutes. Once it gets a fix, the icon will stop animating in the status bar. – Reno Mar 17 '11 at 13:47
  • Duh ... It finally happened after 20 mn ... Ok, solution was : wait long enough ... If you wish put it as an answer and I'll accept it. – user244129 Mar 17 '11 at 14:54

1 Answers1

3

It takes a while to get a location fix. The time to first fix de(TTFF) depends on a lot of factors, like number of visible GPS satellites, signal to noise ratio, the GPS chipset etc ...

Here is a nice article that will help you get the best out of GPS on android phones.

Reno
  • 33,594
  • 11
  • 89
  • 102