1

I need to know if there is a way to keep an android wear app always in interactive mode. (i knonw this will drain battery life)

Is the 'rotate away' gesture adressable or will the watch just go in ambient whenever the watch goes on it outer side?

  • Most likely not. Also you have to remember there are two things at play here: Interactive mode where the screen is used to its fullest and the low/high power mode of the processor. For example with a WakeLock you can keep the processor active, but that won't keep the screen from turning off. – Xaver Kapeller Sep 27 '16 at 06:47
  • Not sure this is still useful info, but I have a Referee Watch that uses 3 of the 4 wakelocks to achieve what you want. It is not accurate that "[it]won't keep the screen from turning off" - you can do that too. PM me if you want details. – Opus1217 Apr 14 '17 at 15:05

1 Answers1

2

The answer depends on whether your "app" is an activity or a service.

An activity should simply specify android:keepScreenOn="true" without the need to do anything further.

If it's a service (e.g. you are making an alarm/timer watch face), I recommend starting a transparent "always-on" activity. AFAIK, currently, the system will not allow your service to keep the screen on with a full wake lock beyond the normal screen-on cycle duration. This is likely due to wake lock misuse. With an Activity, this is possible currently, and has the benefit of handling dismiss actions for you (e.g. side button press, palm, etc). I used a similar pattern in a set of "timer" watch faces.

Here's how you might achieve always-on from a service:

In a Service/Activity responsible for waking the watch:

private PowerManager.WakeLock mFullWakeLock;

// Initialization...
PowerManager pm =(PowerManager) getSystemService(Context.POWER_SERVICE);
mFullWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "WatchFaceAlarmWokenUp");

// Elsewhere, when the watch needs to be woken by the service...
// Wake the watch to give ourselves some time to start the activity
mFullWakeLock.acquire(2000l);

Intent intent = new Intent(this, AlarmExpiredActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

Your AlarmExpiredActivity layout must specify the following property: android:keepScreenOn="true"

I would recommend you also specify android:onClick="hide" to make it easier for users to kill something that's draining their watch.

Vasiliy Kulakov
  • 5,401
  • 1
  • 20
  • 15