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

Background geolocation Android 14 and ionic 7 #116

Closed
danirm96 opened this issue May 14, 2024 · 1 comment
Closed

Background geolocation Android 14 and ionic 7 #116

danirm96 opened this issue May 14, 2024 · 1 comment

Comments

@danirm96
Copy link

I'm developing an app with Ionic 7 and Angular 17. I'm trying to use background geolocation with BackgroundGeolocation (@capacitor-community/background-geolocation) for Android 14 through the plugin watcher, but after a few minutes (2/3), it stops emitting the location.

In the AndroidManifest.xml file, I've added:

And with the Geolocation plugin (@capacitor/geolocation), I'm requesting permissions using Geolocation.requestPermissions().then().catch();. According to the documentation, everything seems correct, but it stops emitting the location after a few seconds.

I've tried different code, but nothing seems to work. This is the closest I've gotten, where I managed to display the notification that it's collecting the location through the watcher.

@diachedelic
Copy link
Collaborator

So you are using @capacitor/geolocation alongside this plugin? That combo is known to cause at least one issue: #104. Calling addWatcher requests permissions by default, so you don't need @capacitor/geolocation for that. If you need a foreground watcher, omit backgroundMessage when calling addWatcher.

Make sure you faithfully follow the installation instructions for Android. Any misstep will cause background location updates to flake out.

Let me know how you go.

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

2 participants