capacitor-community / capacitor-community/background-geolocation
Notification not showing persistently
- Dominant language
- Java
- Stars
- 249
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
The Notification is showing when addWatcher() is called.
However it is supposed to be persistent but i can dismiss it and it never shows again after that.
Additionally, the Notification doesnt show the title and message body passed as part of the options object. Instead the notification shows a default text. It does however show the correct icon
**Expected behavior**
Notification can not be dismissed and it shows the title and message given in the options object
**Smartphone (please complete the following information):**
- Device: Galaxy XCover 5
- OS: Android 13
- Version API 33
- Language: German
**Additional context**
Note:
- Push Notification permission is granted through @capacitor/local-notifications before the watcher is added
- useLegacyBridge option in capacitor config is set to true
strings.xml
```
(omitted)
some.url.scheme
Background Tracking
drawable/ic_tracking
yellow
```
Manifest.xml
```
(omitted)
(omitted)
(omitted)
```
addWatcher
```
await BackgroundGeolocation.addWatcher(
{
backgroundTitle: 'test title',
backgroundMessage: 'tesst message',
distanceFilter: GpsService.distanceFilter,
requestPermissions: true,
stale: false,
},
async (position, error) => {
if (error) {
if (error.code === 'NOT_AUTHORIZED') {
if (window.confirm('error text') {
// It can be useful to direct the user to their device's
// settings when location permissions have been denied. The
// plugin provides the 'openSettings' method to do exactly
// this.
BackgroundGeolocation.openSettings();
}
}
return console.error(error);
} else {
const { latitude, longitude, accuracy, time } = position;
// not too sure if the return is nessecary
return {
latitude,
longitude,
accuracy,
timeestamp: time,
};
}
return console.log(location);
}
);
```
Contributor guide
Research direction
Start with the Android notification behavior triggered by addWatcher(), using the backgroundTitle and backgroundMessage options shown here. Review the provided strings.xml and Manifest.xml configuration while reproducing the issue on Android 13. Done means the notification remains persistent and displays the supplied title and message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100