katzer / cordova-plugin-background-mode

Keep app running in background
Apache License 2.0
1.38k stars 1.02k forks source link

Background service stops when device is put to sleep or locked #461

Open neildborbon opened 5 years ago

neildborbon commented 5 years ago

I have an app where it sends the device's coordinates to my DB every 15 seconds even when app is closed already using this plugin. It works fine, but when the phone is put to sleep or locked, it stops sending data to my DB but will continue when you unlock the phone.

HOPING FOR A QUICK RESPONSE FOR THIS. Thank you!

neildborbon commented 5 years ago

@pimol Yea, after some researching, I realized its not possible. So I just did a "work around". I used a cordova plugin, Insomnia, which will prevent the phone from sleeping or locking as long as the app is active. But the draw back on this is that it will still stop the service if the user presses the physical lock button. So yea, its annoying that google haven't addressed this issue yet :( I dunno if this is a FEATURE or a BUG.

neildborbon commented 5 years ago

I am using ionic by the way, and for the work around that I mention above, I used this for it ...

https://ionicframework.com/docs/native/insomnia

megadrazz commented 5 years ago

463

aqui esta os passos que coloquei para resolver esse problema em android 8 e android 9!!!! vlw