lm = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
Criteria c = new Criteria();
provider = lm.getBestProvider(c, false);
l = lm.getLastKnownLocation(provider);
if (l != null) {
longitude = l.getLongitude();
latitude = l.getLatitude();
}
I have code to get longitude and latitude of user's location. It works fine in certain android devices only when it returns provider by network. However, when it returns provider by gps in some other devices, it does not return user's location. It returns null Please help me