Foreground service doesn't work in Android 10
See original GitHub issueHi,
In Android 10 the service definition in the manifest file must have: android:foregroundServiceType="location"
in order for the foreground service to work properly (ie. when user select “only while using app” as location permission.
<service android:enabled="true" android:exported="false" android:foregroundServiceType="location" android:name="com.marianhello.bgloc.service.LocationServiceImpl" />
I hope it is possible to add this in the next version.
Does anyone have a quick fix for this? My current solution is to add the line manually to the manifest file after each “cordova prepare”. It is just a matter of time before I forget it before releasing.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13
Top Results From Across the Web
Foreground services - Android Developers
Foreground services perform operations that are noticeable to the user. Foreground services show a status bar notification, so that users are actively aware ......
Read more >App not sending location from Foreground service on Android ...
I have a foreground service sending location updates. The app stops sending locations when the following conditions are met: Running on Android ......
Read more >The “misbehaving” foreground service in Android
Foreground services According to the official android documentation, a foreground service performs operations that are noticeable to the user. ...
Read more >Auto-Start Foreground Service in Android - Medium
Perfect way to run service even Android device restarted ... What is the foreground service? Now let me tell you a little bit...
Read more >WorkManager long-running work doesn't work specifying ...
Devices/Android versions reproduced on: Pixel 4 - Android 10 ... at android.app.Service.startForeground(Service.java:742) at androidx.work.impl.foreground.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To be honest, this (discontinued) plugin and all (I guess - don’t know all) forks are dying due to the lack of adjustments to the latest SDKs and other evolution. There have been a lot of changes in Android 10 + 11 regarding the background (always) permission and capability of sending position updates in the background. Also iOS 14 introduced the approximate location. Additionally many major vendors kill apps in the background, see https://dontkillmyapp.com/ So this plugin should actually be renamed to cordova-plugin-foreground-geolocation. 😉 Only the original (paid) plugin seems to keep track of the plugin to work in the background/minimized: https://github.com/transistorsoft/cordova-background-geolocation-lt
That is true, actually Im starting to train myself in Flutter because all of this issues with cordova.