当我执行这样的requestLocationUpdates时:
FusedLocationProviderClient fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(context);
LocationRequest locationRequest = new LocationRequest();
locationRequest.setInterval(150000);
locationRequest.setFastestInterval(30000);
locationRequest.setMaxWaitTime(900000);
locationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
locationRequest.setSmallestDisplacement(0);
fusedLocationProviderClient.requestLocationUpdates(locationRequest, getPendingIntent(context));
然后立即解雇onReceive(Context context, Intent intent)
,而无需照顾setMaxWaitTime(900000)
。这是正常现象吗?
答案 0 :(得分:1)
在LocationUpdatesPendingIntent中有一个小的免责声明:
// Sets the maximum time when batched location updates are delivered. Updates may be
// delivered sooner than this interval.
mLocationRequest.setMaxWaitTime(MAX_WAIT_TIME);