Closed jongbonga closed 1 year ago
Just my two cents, but I believe you can use the Capacitor Permissions plugin to check which permissions have been granted.
As far as I know, this plugin doesn't use the ACCESS_BACKGROUND_LOCATION
permission, but instead utilizes a foreground service. This is why there is a persistant notification. The ACCESS_BACKGROUND_LOCATION
permission is a bit more intense, and requires you to send in a video explaining and demonstrating exactly how you use that permission.
That is correct. Don't worry about the background permission.
@alexandermccormick I did send a video demonstrating the use, but my user still experience issue tracking the location when the driver is an Android user, and I keep seeing the above issue on Sentry.
and my options on the app look like
{
backgroundTitle: 'My App is tracking your trip.',
backgroundMessage: 'My App is operating on the background.',
distanceFilter: prodMode ? 2 : 0
}
So not sure how to handle it.
Some Android devices need battery saving optimizations disabled (via the Settings app) to reliably receive location updates in the background. Your Sentry report mentioning ACCESS_BACKGROUND_LOCATION is a red herring - this plugin does not need that permission.
What problem is your user experiencing exactly?
Your Sentry report mentioning ACCESS_BACKGROUND_LOCATION is a red herring - this plugin does not need that permission.
I added it since I thought that was the reason I wasn't getting constant updates.
What problem is your user experiencing exactly?
The location is not being received or sent after a while.
I will remove ACCESS_BACKGROUND_LOCATION
and try again and revert when I get updates
Make sure you are using the legacy bridge, otherwise location updates will stop after 5 minutes in the background on Android. https://github.com/capacitor-community/background-geolocation#android
Make sure you are using the legacy bridge, otherwise location updates will stop after 5 minutes in the background on Android. https://github.com/capacitor-community/background-geolocation#android
Are you familiar with the limitations on sending HTTP requests while the app is in the background? See https://github.com/capacitor-community/background-geolocation/issues/14#issuecomment-1293574693.
Are you familiar with the limitations on sending HTTP requests while the app is in the background? See #14 (comment).
Yes, I use the capacitor http plugin. I'm busy testing with different devices to see if the issue is not our my server instead.
I will update asap.
Here are my findings:
AppName is running
& the message: Tap for more information or to stop the app
.My plugin:
My permissions
My Capacitor config
strings.xml
Is there anything I could have missed?
I would say your problem is the notification. If the notification is not correctly configured, background location updates don't work properly. Make sure you've generated the icon correctly, using Android Studio:
<!--
The icon to use for the background notification. Note the absence of a
leading "@". It defaults to "mipmap/ic_launcher", the app's launch icon.
If a raster image is used to generate the icon (as opposed to a vector
image), it must have a transparent background. To make sure your image
is compatible, select "Notification Icons" as the Icon Type when
creating the image asset in Android Studio.
-->
<string name="capacitor_background_geolocation_notification_icon">
drawable/ic_tracking
</string>
If the notification is misconfigured, it seems to open the Settings app when tapped, rather than your app.
Make sure you've generated the icon correctly, using Android Studio
Let me try this. My icons are generated with the capacitor assets plugin
They were all there already.
I will run and see if the notification appears after this.
I got the notification working.
I did this.
To make sure your image is compatible, select "Notification Icons" as the Icon Type when creating the image asset in Android Studio.
My mistake was the name of the icon that I did not set properly. I kept the one from the example: ic_tracking
.
I will revert later if I encounter issues.
Thanks for your patience and assistance.
No worries, glad you got it working.
Is your feature request related to a problem? Please describe. Currently, with the capacitor Geolocation plugin, we can check for permission status but it does not provide status for background location. especially for Android.
This is from Sentry Diagnostics.
Describe the solution you'd like Can this plugin offer a way to check which permission is granted (coarse, fine or background)?