Keep Android Wear app running in Ambient Mode

android

#1

Hi everyone. I am a web developer and this is my first experience building a native mobile app, and I am delighted by the ease of use of NativeScript, so - kudos to the devs.

I built an app for Android Wear OS that has a timer and needs to notify the user when the time runs out. All works good, except when the phone goes into Ambient Mode the app basically stops running too.

Does anyone know how to keep the app running in background? I have tried looking for answers, but no luck.


#2

Try background services.


#3

HI, thanks for your reply.

I am trying to wrap my head around that. I am using an Angular Service that holds the state of the timer. Do you have a similar example for this use case?


#4

Angular is live only when your app is in foreground. You can’t relay on Angular, if you want the timer to be active even when app is not running, it should be maintained in a background service.