I am using the plugin GitHub - seididieci/capacitor-backround-geolocation: Ionic capacitor backgroung geolocation Plugin for my app background location tracking. Here is method in plugin goForeGround()
which is suppose to work when application is in background but it is not working giving me this error
message: "Cannot start a foreground Service: user denied FOREGROUND permissions." __proto__: Object
Here is my code
BackgroundGeolocation.initialize({
notificationText: "Your app is running, tap to open.",
notificationTitle: "App Running",
updateInterval:10000,
requestedAccuracy: BgGeolocationAccuracy.HIGH_ACCURACY,
// Small icon has to be in 'drawable' resources of your app
// if you does not provide one (or it is not found) a fallback icon will be used.
smallIcon: "ic_small_icon",
// Start getting location updates right away. You can set this to false or not set at all (se below).
startImmediately: true,
});
BackgroundGeolocation.goForeground()
In my AndroidManifest
FileI have also mentioned this
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
On the phone location is also selected as Allow Always
But still i am receiving this error what could be the reasong