Why foreground service when implementing background location listener #13643
Unanswered
beppo-ivel
asked this question in
Q&A
Replies: 1 comment 1 reply
-
The foreground service is needed because of Android. Check https://developer.android.com/guide/components/foreground-services for all the restrictions you have. I think it started in Android Oreo that you can't start a service in the background that runs longer than 10secs without a foreground notification. The system can kill the app when it is in the background if needed. The foreground notification is there to keep it alive. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Compare to this and this example I implemented a app. So after click start button the
locationService.js
is executed once and terminates.If I implemented without the foreground notification I got only two records in my debug file one by clicking start and one by clicking stop button.
But why I have to implement this
foregroundNotify
service to keep the location event listener alive? And how to remove the Notification from status bar? I got an error if I try to stop the service or callTi.Android.currentService
because the service seems already terminated.index.js
locationService
Beta Was this translation helpful? Give feedback.
All reactions