Skip to content

watchPosition fails if phone in airplane mode #39

@gruble

Description

@gruble

Thank you for providing this excellent software!

We have had this issue since 7.0.0. I just tested 7.1.5 and the problem still occurs.
This was not an issue in Capacitor 6.
This happes only if phone is in airplane mode. Tested on Samsung S10e with Android 12.

When we call Geolocation.watchPosition() we get one callback that contains an error with message "Location settings error" and code "OS-PLUG-GLOC-0016". And the posisition is null. Then we get no more callbacks.

The options we use for watch is:

PositionOptions = {
  enableHighAccuracy: true,
  timeout: 20 * 1000, // 20 sec
  maximumAge: 0, //we do not accept cached positions, ask for GPS position immediately
};

When I debug the plugin itself I can see that the plugin get this exception in startWatch():
com.google.android.gms.common.api.ApiException: 8502: SETTINGS_CHANGE_UNAVAILABLE

I found a similar case here: android/location-samples#47

It is important for us that we can get position data in airplane mode, because our users need to save battery when they use our app in the field.
Is it possible that you can handle this quirk from Android API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions