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

Background execution limits in Android Oreo (API level 26) #1198

Closed
daniele-athome opened this issue Jul 30, 2018 · 3 comments
Closed

Background execution limits in Android Oreo (API level 26) #1198

daniele-athome opened this issue Jul 30, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@daniele-athome
Copy link
Member

daniele-athome commented Jul 30, 2018

Android introduced background execution limits for apps targeting API level 26. This will make life very difficult for a long-lived connection service such as our message center. FCM whitelisting is not really an option because it lasts 10 seconds 😕

Consider using a permanent foreground service when running on Android 8 (it sucks I know).


Commit 935bafe introduced manual registration of the network state receiver, although it never showed problems so far, I'm not sure it's the correct way to go. I mean, the registration happens only when the application context is running. But when the process will be removed from memory, the context will go away, together with the broadcast receiver. We'll keep the receiver registered because it can be useful while the app is running, but we need something else to wake us up eventually.


Using WorkManager is a no-go for now because we're not ready to switch to AndroidX yet. However, we could just use a foreground service on API levels that require it and stick to the background service otherwise.

So this means startForegroundService on every call. Expect for older Android versions where we could check if the user granted us background execution. Otherwise just force a foreground service 👼

Other IntentService-based stuff (or similar) should probably be migrated to JobIntentService.

Deadline: 2018-11-01


https://developer.android.com/about/versions/oreo/background

@daniele-athome daniele-athome added the enhancement New feature or request label Jul 30, 2018
@daniele-athome
Copy link
Member Author

Pull request #1228 opened.

@daniele-athome
Copy link
Member Author

Aaaaand my Oreo phone is already showing a "Kontalk is using battery" notification. Probable cause:

https://stackoverflow.com/questions/45485460/is-it-possible-to-put-a-foreground-service-notification-in-a-notification-channe

@daniele-athome daniele-athome self-assigned this Oct 31, 2018
@daniele-athome
Copy link
Member Author

Closed by #1228.

@daniele-athome daniele-athome added this to the Next milestone Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant