3
我有一个LocationReceiver
,它使用FusedLocationProviderApi.KEY_LOCATION_CHANGED
从Intent
中提取Location
。但现在KEY_LOCATION_CHANGED
已弃用,应该将其更改为?已弃用FusedLocationProviderApi.KEY_LOCATION_CHANGED。现在做什么?
当前代码:
@Override
public void onReceive(Context context, Intent intent) {
final Location location = (Location) intent.getExtras().get(FusedLocationProviderApi.KEY_LOCATION_CHANGED);
if (location != null) {
float accuracy = location.getAccuracy();
Log.d(LocationReceiver.class.getSimpleName(), "*** Accuracy is: " + accuracy + " ***");
} else {
Log.d(LocationReceiver.class.getSimpleName(), "*** location object is null ***");
}
}
你在哪里找到这个答案?我想看看上下文。谢谢! – smfoote
刚刚探讨了[api](https://developers.google.com/android/reference/com/google/android/gms/location/LocationResult)。 – MidasLefko
谢谢!这就是我一直在寻找的。 – smfoote