Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work on Android 8 (Oreo) #97

Open
dpa99c opened this issue Aug 29, 2017 · 5 comments
Open

Doesn't work on Android 8 (Oreo) #97

dpa99c opened this issue Aug 29, 2017 · 5 comments

Comments

@dpa99c
Copy link

dpa99c commented Aug 29, 2017

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.

@dpa99c dpa99c changed the title Question: Android 8 Background Location Limits Doesn't work on Android 8 (Oreo) Sep 10, 2017
@netbrothers-tr
Copy link

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.

@pmwisdom
Copy link
Owner

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.

@NurGuz23
Copy link

Any idea here?

@RikdeBoer
Copy link

RikdeBoer commented Jul 2, 2018

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

@tlacroix
Copy link

tlacroix commented Dec 1, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants