I enabled the GPS in my device but I am not getting the loaction:
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
if(lm.isProviderEnabled(LocationManager.GPS_PROVIDER))
{
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if(location!=null)
{
showCurrentAddress(location);
}
}
But here I am gettin location is null and I added the following permissions to my code:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Could you please help?