-
Notifications
You must be signed in to change notification settings - Fork 12
feat(android): New parameter interval in watchPosition
#62
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
Merged
OS-pedrogustavobilro
merged 5 commits into
next
from
feat/RMET-4688/android-timeout-interval
Nov 21, 2025
Merged
feat(android): New parameter interval in watchPosition
#62
OS-pedrogustavobilro
merged 5 commits into
next
from
feat/RMET-4688/android-timeout-interval
Nov 21, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Because we have "next" as `peerDependency` that causes pnpm install to fail `ERR_PNPM_INVALID_PEER_DEPENDENCY_SPECIFICATION The peerDependencies field named '@capacitor/core' of package '@capacitor/geolocation' has an invalid value: 'next'`
Because the native Android library now applies the `timeout` explicitly to `addWatch`, we should allow consumers of this plugin to configure interval's to be lower that timeout, while leaving default value of `timeout` for backwards compatibility with versio 7.1.x We document this as a breaking change, as it has the possibility of causing location timeouts where there previously were none. There was also an equivalent breaking change for iOS, in a previous PR. References: - https://outsystemsrd.atlassian.net/browse/RMET-4360 - https://outsystemsrd.atlassian.net/browse/RMET-4688 - #55 BREAKING CHANGE: The `timeout` property now gets applied to all requests on Android on iOS, as opposed to just web and `getCurrentPosition` on Android. This aligns with what is documented in the plugin. If you are experiencing timeouts when requesting location in your app, consider using a higher `timeout` value. For `watchPosition` on Android, you may use the `interval` parameter introduced in version 8.0.0.
OS-ruimoreiramendes
approved these changes
Nov 20, 2025
Contributor
OS-ruimoreiramendes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the example app in this repo and tried to repeat the same tests we did on iOS a few days/weeks ago, and it seems to be working fine.
alexgerardojacinto
approved these changes
Nov 20, 2025
OS-pedrogustavobilro
added a commit
that referenced
this pull request
Nov 21, 2025
# [8.0.0-next.7](v8.0.0-next.6...v8.0.0-next.7) (2025-11-21) ### Features * **android:** New parameter `interval` in `watchPosition` ([#62](#62)) ([7fda0cf](7fda0cf)) ### BREAKING CHANGES * The `timeout` property now gets applied to all requests on Android on iOS, as opposed to just web and `getCurrentPosition` on Android. This aligns with what is documented in the plugin. If you are experiencing timeouts when requesting location in your app, consider using a higher `timeout` value. For `watchPosition` on Android, you may use the `interval` parameter introduced in version 8.0.0.
capacitor-bot
pushed a commit
that referenced
this pull request
Nov 26, 2025
# [8.0.0-next.6](v8.0.0-next.5...v8.0.0-next.6) (2025-11-26) ### Features * **android:** New parameter `interval` in `watchPosition` ([#62](#62)) ([7fda0cf](7fda0cf)) ### BREAKING CHANGES * **android:** The `timeout` property now gets applied to all requests on Android on iOS, as opposed to just web and `getCurrentPosition` on Android. This aligns with what is documented in the plugin. If you are experiencing timeouts when requesting location in your app, consider using a higher `timeout` value. For `watchPosition` on Android, you may use the `interval` parameter introduced in version 8.0.0.
capacitor-bot
pushed a commit
that referenced
this pull request
Dec 8, 2025
# [8.0.0](v7.1.6...v8.0.0) (2025-12-08) ### Bug Fixes * **android:** use 'propName = value' assignment syntax in build.gradle files ([08f311a](08f311a)) * **ios:** added timeout implementation for both getCurrentPosition and watchPosition ([#55](#55)) ([4c22ac3](4c22ac3)) * peerDependency for pnpm compatibility ([a94839d](a94839d)) ### Features * **android:** Fallback option for no network or Play Services ([#53](#53)) ([09277b7](09277b7)) * **android:** New parameter `interval` in `watchPosition` ([#62](#62)) ([7fda0cf](7fda0cf)) * Capacitor 8 support ([6ead26a](6ead26a)) ### BREAKING CHANGES * **android:** The `timeout` property now gets applied to all requests on Android on iOS, as opposed to just web and `getCurrentPosition` on Android. This aligns with what is documented in the plugin. If you are experiencing timeouts when requesting location in your app, consider using a higher `timeout` value. For `watchPosition` on Android, you may use the `interval` parameter introduced in version 8.0.0. * Capacitor major version update requires major version update on the plugin.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new parameter
intervaltowatchPositionin Android, to allow configuring specific intervals in which to receive location updates.In version 7.1.x of the plugin,
timeoutwas used for this purpose, which, even if documented, is prone to confusion.. Now we are applying thetimeoutparameter for its original purpose - to give a timeout error if a location isn't returned until the specifiedtimeoutvalue. This is implemented in the latest version of our Geolocation android native library (2.1.0).To maintain backwards compatibility with versions 7.1.x, the default value of
intervalis that oftimeout. Users should explicitly provide a different value (possibly lower thantimeout) if they want to.This is technically a breaking change (or has the potential to break client apps), as detailed below in this PR description.
This PR also contains updates the lockfiles to be npm instead of pnpm in this repo, because we have configured
nextpeerDependency which does not work with pnpm.Context
Type of changes
BREAKING CHANGE: The
timeoutproperty now gets applied to all requests on Android on iOS, as opposed to just web andgetCurrentPositionon Android. This aligns with what is documented in the plugin. If you are experiencing timeouts when requesting location in your app, consider using a highertimeoutvalue. ForwatchPositionon Android, you may use theintervalparameter introduced in version 8.0.0.Platforms affected
Tests
Use the example app in this repository to test - has a field for the new
intervalparameter.