pmwisdom/cordova-background-geolocation-services

Doesn't work on Android 8 (Oreo)

Opened this issue · 5 comments

I've tested this plugin on a Nexus 6P running Android 8.0 and it fails to receive location updates while in the background.

Android 8 adds strict Background Location Limits which limits the update interval of the Fused Location Provider API to "only a few times each hour".

FWIW cordova-background-geolocation-lt does work fine on Android 8 with the foreground service option enabled.

FWIW cordova-background-geolocation-lt does work fine on Android 8 with the foreground service option enabled.

Which is a non-free alternative where the cheapest variant costs you $349. I guess that other free solutions will pop up soon, since this seems to be a rather new problem.

I apologize for the late comment. I currently don't have time to look into this, but from the document, it seems like what i'm dong should make this act like a foreground app still.

Another foreground app is connected to the app, either by binding to one of its services or by making use of one of its content providers. For example, if a foreground app binds to any of the following components within another app, that other app is considered to be in the foreground:

PR's are welcome.

Any idea here?

I was forced to upgrade my cordova toolset and as a knock-on effect have ended up with Android 8/API 26.
So I have the same issue.

When you dim the screen while your app is running, background updates continue. But when you flick to another app background updates stop instantly. You will also observe that at that point the location marker disappears from your phone's status bar.

I believe that Android API 26 will be a minimum requirement in Google Play Store next month, so reverting back is not a solution.

It seems the only way forward is to cop it on the chin and program something around startForegroundService()
https://developer.android.com/guide/components/services#Foreground

Facing the same problem. I am not an Android developer, so I can't propose a PR, but I found this to enable foreground services in the meantime:
https://www.npmjs.com/package/cordova-plugin-foreground-service