Aug 3, 2022

I'm developping a tracking application that runs on Wear OS watches. I have some troubles when the watch goes to sleep. As soon as the watch goes to Deep Idle mode, all sensors acquisition stops. For that I'll need to whitelist the app using:

                                Intent intent = new Intent();
                                intent.setData(Uri.parse("package:" + packageName));

This piece of code works well on mobile version but nothing happen on Wear OS version. I realized that Wear OS as no UI to set the battery optimization mode which should be the cause of the fact that nothing happens when trying to change the optimization.

I also used a wake lock to keep the CPU partially awake with:

                PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);

               wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MY-WAKELOCK");

But even with that the watch goes to deep sleep after about 15min ?

The last solution I see is to force the screen on or at least dimmed but it will drain the battery very fast.

Is there another solution to keep sensors working ? How can I whitelist my app on a Wear OS device as no UI seems available ? As anyone already encountered this issue?
Last edited:
Forgot your password?
or Log in using