Search code examples
androidandroid-servicewear-os

Which Service on Wear OS for permanent running in background


I wrote an MQTT Android app on my smartphone and used a normal background service. Now I want to write the same app for a smartwatch with Oreo 8.0. I read some articles about services in Oreo and now I'm really confused.

The recommandation is to use a JobIntentService but can this service run all the time in the background without my app showing on screen?

Can I use a normal IntentService for a permanent running backgroundservice in Oreo?


Solution

  • WearOS is based on the same architecture as regular Android OS running on phones, so you can use a regular Service component that will be kept running in background on your Watch OS very similar to your phone.

    Furthermore, to handle background optimizations like Doze and App Stand-by, you can convert your service to foreground service by providing an ongoing notification etc.

    And by the way, IntentService stop itself when it run out of work, i-e shouldn't be used as permanent running service.