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

To Fix: location updating only each 5 second in certain cases #6

Open
tdurand opened this issue Dec 30, 2020 · 0 comments
Open

To Fix: location updating only each 5 second in certain cases #6

tdurand opened this issue Dec 30, 2020 · 0 comments

Comments

@tdurand
Copy link
Owner

tdurand commented Dec 30, 2020

Right now rolled back the release to commit: 8179409

With Capacitor Geolocation 2.x , the geolocation provided by android is only updated each 5 second in certain cases.. which cause the app to be unusable.

When using capacitor geolocation 1.x, the location update is called like this: https://github.com/ionic-team/capacitor/blob/1.5.3/android/capacitor/src/main/java/com/getcapacitor/plugin/Geolocation.java#L96 , telling android to give position as fast as possible

private void startWatch(PluginCall call) {
    String provider = getBestProviderForCall(call);
    locationManager.requestLocationUpdates(provider, 0, 0, locationListener);

    watchingCalls.put(call.getCallbackId(), call);
  }

But with 2.x, it somehow tells to update only every 5s

https://github.com/ionic-team/capacitor-plugins/blob/main/geolocation/android/src/main/java/com/capacitorjs/plugins/geolocation/Geolocation.java#L50

LocationRequest locationRequest = new LocationRequest();
        locationRequest.setMaxWaitTime(timeout);
        locationRequest.setInterval(10000);
        locationRequest.setFastestInterval(5000);

I tried to changes those value directly but the better would be to expose them to the capacitor javascript plugin.. and also I'm not sure they work super well yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant