How to detect my WatchFace is being used or stopped being used

177 Views Asked by At

I have a service that does some extra work for android wear. I want to invoke the extra work only when the user is seeing my watch face.

One way to detect that the watch face is being invoked is by using the sendMessageAPI and a message will come.

How to know when the watchface has been changed?

Is message the only way to achieve this or there is some clean function given by the WearAPIs?

Thanks in Advance.

1

There are 1 best solutions below

2
On

When the user chooses your watch face, the WatchFaceService.Engine subclass will receive onCreate callback and when it is stopped being used, it will receive onDestroy callback. Do the work between these two callbacks.