euphoria83
euphoria83

Reputation: 15146

GPS is on, yet LocationManager returns null

The GPS on my Android phone is on, supported by the fact that :

location_manager.isProviderEnabled(LocationManager.GPS_PROVIDER)

returns true.

Yet, the following line :

 Location location = location_manager.getLastKnownLocation(LocationManager.GPS_PROVIDER) ;

returns null.

What could be the reason ?

Thanks.

Upvotes: 1

Views: 889

Answers (1)

Nikola Smiljanić
Nikola Smiljanić

Reputation: 26863

You should requestLocationUpdates and wait for the first one.

Upvotes: 3

Related Questions