-
Notifications
You must be signed in to change notification settings - Fork 2.8k
LocationUpdatesForegroundService doesn't implement onLocationAvailability() - which stopped working "recently" #283
Comments
Is this with the current "master" of the example, and which version of Android is it not working on for you? I'm going through a few of these examples and updating them to target the latest API and dependency versions to ensure they work with all of the changes imposed on us by Google. Would be nice if they updated the samples, but luckily it's open source so we can do it. See #285 for the background location sample. |
The issue here is more of a suggestion. The What was not working for me wasn't an issue with the sample itself, but i came here to see if i could find a solution. It turned out that Google Play Services (at least v21.33.xx - 21.36.xx) made an error: They would always call |
I understand that the
|
Thanks for the detailed responses. I'm not a maintainer of this repository, just an interested dev. Great work on pushing them to get that issue fixed! Definitely agree that the samples should include the fun requestLocationServices(activity: Activity) {
val settingsClient = LocationServices.getSettingsClient(activity)
val locationRequest = LocationRequest.create()
val locationSettingsRequest = LocationSettingsRequest.Builder()
.addLocationRequest(locationRequest)
.build()
settingsClient.checkLocationSettings(locationSettingsRequest)
.addOnFailureListener {
val statusCode = (it as ApiException).statusCode
if (statusCode == LocationSettingsStatusCodes.RESOLUTION_REQUIRED) {
val resolvable = it as ResolvableApiException
resolvable.startResolutionForResult(activity, REQUEST_LOCATION_SETTINGS)
}
}
} I'll update my PR to include this as part of the background location sample. |
Had a quick look at the background sample and it handles the |
Hi @chnt, from my understanding based on the discussion on the issue tracker is that |
@joostfunkekupper It works 100% of the time for me, and has done so for years ... except for the months of September 2021 and most of October 2021 when Google Play Services 21.33.xx - 21.36.xx introduced the error of having it |
Glad to hear its working again for you @chnt. Based on my testing with Play Service 21.39.17, I'm still receiving What I am doing is that if I receive a |
com.google.android.gms.location.sample.locationupdatesforegroundservice.LocationUpdatesService
ln-137The
LocationCallback
does not overrideonLocationAvailability(availability: LocationAvailability?)
to provide info on whether location updates will actually be provided by this service at all.Cheers
Christian
The text was updated successfully, but these errors were encountered: