GoogleChromeLabs / GoogleChromeLabs/bubblewrap

locationDelegation - navigator.geolocation.watchPosition() only retrieves position once

Open
#908 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.1k
Forks
319
PR merge metrics
No merged PRs in 30d

Description

When using navigator.geolocation.watchPosition, the native android prompt dialog for enabling geolocation pops up as intended.
The location is retrieved, but it is only retrieved once.
The position does not update when moving the device to another position.

navigator.geolocation.watchPosition works fine when using the PWA via regular chrome browser.
Its only within the TWA the position is not updated.

Further note:
wrapping navigator.geolocation.getPosition in a setInterval works fine in TWA, the correct position is retrieved for each interval.
The problem is only with navigator.geolocation.watchPosition in TWA.

**To Reproduce**
Steps to reproduce the behavior:
1. Create TWA using bubblewrap were locationDelegation feature is enabled
2. Run navigator.geolocation.watchPosition
3. Enable geolocation within the delegated prompt.
4. Position is only updated once, it does not change when moving the device away from the current position.

**Expected behavior**
The position should automatically update when the device moves away from the current position..

**Smartphone (please complete the following information):**
- Device: Samsung Galaxy S21 Ultra
- OS: Android
- Browser: chrome (via TWA)
- Version: latest

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.