Getting Null On Current Location On Samsung Galaxy Grand Android?
I'm try to run my app on Samsung Galaxy Grand but its not showing my current location. locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); //
Solution 1:
Check this for the answer, for short
To programmatically kick start your app for "current location" run the following code before you call getLastKnownLocation
YOUR_APPLICATION_CONTEXT.getLocationManager().requestLocationUpdates(
LocationManager.NETWORK_PROVIDER, 0, 0, new LocationListener() {
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void onLocationChanged(final Location location) {
}
});
Some recommendations for fixing GPSTracker issues may be, to set it as 1 min 1 meter
privatestaticfinallong MIN_DISTANCE_CHANGE_FOR_UPDATES = 1;
privatestaticfinallong MIN_TIME_BW_UPDATES = 1000 * 60 ;
Post a Comment for "Getting Null On Current Location On Samsung Galaxy Grand Android?"