Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent GeofencingRequest exception on no zones #3857

Merged

Conversation

jpelgrom
Copy link
Member

Summary

Prevent the following exception from occuring, which can happen when the app gets no zones like in case of no connectivity or a broken webhook. The exception was already caught but even better to handle it so the behavior is expected :)

09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: Issue requesting zone updates.
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: java.lang.IllegalArgumentException: No geofence has been added to this request.
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at com.google.android.gms.common.internal.Preconditions.checkArgument(com.google.android.gms:play-services-basement@@18.1.0:2)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at com.google.android.gms.location.GeofencingRequest$Builder.build(com.google.android.gms:play-services-location@@21.0.1:2)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at io.homeassistant.companion.android.sensors.LocationSensorManager.createGeofencingRequest(LocationSensorManager.kt:956)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at io.homeassistant.companion.android.sensors.LocationSensorManager.access$createGeofencingRequest(LocationSensorManager.kt:51)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at io.homeassistant.companion.android.sensors.LocationSensorManager$createGeofencingRequest$1.invokeSuspend(Unknown Source:14)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
09-11 16:41:21.779 24666 28243 E LocBroadcastReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

Screenshots

n/a

Link to pull request in Documentation repository

n/a

Any other notes

@JBassett JBassett merged commit fb1bdc0 into home-assistant:master Sep 13, 2023
3 checks passed
@jpelgrom jpelgrom deleted the no-geofence-for-empty-zones branch September 13, 2023 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants