我正在尝试添加新版本的FusedLocationClient。我想在某种情况下这样做,我的手机处于离线模式,GPS开启!
我做了什么==>
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(getApplicationContext());
LocationCallback locationCallback = new LocationCallback() {
@Override
public void onLocationResult(LocationResult locationResult) {
super.onLocationResult(locationResult); // why? this. is. retarded. Android.
Location currentLocation = locationResult.getLastLocation();
System.out.println("Loc => " + currentLocation.getLatitude());
}
;
};
mFusedLocationClient.requestLocationUpdates(mLocationRequest, locationCallback, Looper.myLooper());
但是当我打印它时我得到一个null结果。我真的不明白为什么。如果有人能向我解释什么是错的,那就太大了!