Java – A perpetual service on android oreo

A perpetual service on android oreo… here is a solution to the problem.

A perpetual service on android oreo

Android 8’s battery consumption improvements are good for users, but I’m a little worried about whether my service will work as expected.

First of all: thanks for any suggestions, but I can’t just schedule my services. I want to make an OK Google-like keyword listener that runs in the background all the time. It will be based on the open-source Pocketsphinx-Android library. I know this consumes a lot of battery power and I’ll notify the user.

Can we create a permanent background service on android 8+? I need to target android 8 in Gradle as I was expecting some bugs for old targets. I also don’t want to bother users with a foreground service that permanently displays notifications in the status bar.

[ ] – Is there really no way to provide a permanent background service for my use case (but preferably for all use cases)?


Unfortunately, background services are not available on Android 8.0 and higher and foreground notifications are not displayed.

The only way to do this is to bind your application to a Google API, such as Voice Actions API

As far as I know, there is no good workaround yet, and most apps like WhatsApp still target Android API 24.

Related Problems and Solutions