Skip to content

Instantly share code, notes, and snippets.

@mcgill-a
Last active September 25, 2023 13:52
Show Gist options
  • Save mcgill-a/db12926331f47f3a8672a996b9067a12 to your computer and use it in GitHub Desktop.
Save mcgill-a/db12926331f47f3a8672a996b9067a12 to your computer and use it in GitHub Desktop.
A minimal frontend snippet for using GPS data in Angular
// https://github.com/capacitor-community/background-geolocation
this.BackgroundGeolocation.addWatcher(
{
requestPermissions: true,
stale: false,
distanceFilter: 10
},
(current, error) => {
if (!current || error) return;
const { latitude, longitude, time } = current;
console.log(latitude, longitude, time);
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment