Open
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
<?xml version='1.0' encoding='utf-8'?>
<resources>
(omitted)
<string name="custom_url_scheme">some.url.scheme</string>
<!--
The channel name for the background notification. This will be visible
when the user presses & holds the notification. It defaults to
"Background Tracking".
-->
<string name="capacitor_background_geolocation_notification_channel_name">
Background Tracking
</string>
<!--
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>
<!--
The color of the notification as a string parseable by
android.graphics.Color.parseColor. Optional.
-->
<string name="capacitor_background_geolocation_notification_color">
yellow
</string>
</resources>
Manifest.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
(omitted)
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:ignore="CoarseFineLocation" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
(omitted)
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true" android:hardwareAccelerated="true">
(omitted)
<activity
android:exported="true"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation" android:label="@string/title_activity_main" android:launchMode="singleTask" android:name="omitted" android:theme="@style/AppTheme.NoActionBarLaunch">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/custom_url_scheme" />
</intent-filter>
</activity>
<service android:name="com.equimaps.capacitor_background_geolocation.BackgroundGeolocationService" android:enabled="true" android:exported="true" android:foregroundServiceType="location"
android:permission="android.permission.POST_NOTIFICATIONS" />
</application>
</manifest>
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);
}
);
Metadata
Metadata
Assignees
Labels
No labels