Skip to content

Commit

Permalink
fix(geolocation): stop location requests on pause (#1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jun 2, 2022
1 parent 7164318 commit eb24f25
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ public void load() {
implementation = new Geolocation(getContext());
}

@Override
protected void handleOnPause() {
super.handleOnPause();
// Clear all location updates on pause to avoid possible background location calls
implementation.clearLocationUpdates();
}

@Override
protected void handleOnResume() {
super.handleOnResume();
for (PluginCall call : watchingCalls.values()) {
startWatch(call);
}
}

/**
* Gets a snapshot of the current device position if permission is granted. The call continues
* in the {@link #completeCurrentPosition(PluginCall)} method if a permission request is required.
Expand Down

0 comments on commit eb24f25

Please sign in to comment.