Sunday, December 11, 2011

Solution for Android LocationManager.getLastKnownLocation() returns null

Consider four things, If map application is not running as your expecting.
To display a Google Maps application, we need to configure the required permission in your application. The permissions required are:
  • android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION
  • android.permission.INTERNET
Generate your own android:apiKey
Check any one of the location is detecting or not
  • Wi-Fi based
  • Network Cell based
  • GPS based
Enable "Use wireless networks" in location settings, If it is not enabled, LocationManager.getLastKnownLocation() returns null.

Ensure above all the points before running map application.

No comments :

Post a Comment