I have a location tracking feature in my app, it works just fine in Samsung devices, but when I run it in Huawei it crashes says mLastLocation is null.
I'm using Google maps API V2 location callbacks in onCreate method:
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
mLocationCallback = new LocationCallback() {
@Override
public void onLocationResult(LocationResult locationResult) {
if (locationResult == null) {
return;
}
if (mLastLocation == null)
return;
}
};
mFusedLocationProviderClient.requestLocationUpdates(mLocationRequest, mLocationCallback, null);
It always return because mLastLocation is always null in Huawei! Is there something to do for devices other than Samsung?