2

With XE21, my Glass constantly auto-dims the screen with a live card. I am trying out the Compass sample and simply want it to stay on screen always. I did find one possible fix which didn't work for me - adding to the FrameLayout the line: android:keepScreenOn="true"

Am I actually adding this in the right place? Would be good to fix this issue. Not sure why auto-dimming the screen cant be a manual setting in Glass Settings. Thanks

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
Doug
  • 17
  • 2
  • It is a setting...you can turn off the sleep lock if you scroll over to your settings. It is in there! – Alex K Sep 12 '14 at 00:04
  • You sure about that Alex? Thanks for the response but if I scroll through settings on the headset then I get things like Head Nudge, Screen on whilst charging, Wink, head detection etc. those sorts of things. But I cant see anything about sleep lock. Definitely in with XE21? – Doug Sep 12 '14 at 13:07

1 Answers1

1

android:keepScreenOn doesn't work in this specific case because the view hierarchy being drawn by the Compass sample isn't actually attached to a window; it's only used to perform some minor layout and then gets drawn directly onto a surface.

For LiveCards, you'll need to hold a wake lock in order to keep the screen on while the card is being viewed by the user. Be careful with this approach though and make sure that you properly manage the lifetime of this wake lock so that you don't hold it excessively. The renderingPaused callback can help you detect when the user has navigated to or from the card.

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
  • Many thanks for the response Tony. Wake lock has been mentioned a few times elsewhere but was hoping to just set an XML parameter. The compass needs to remain on all the time for the user. I will investigate the wake lock approach. – Doug Sep 12 '14 at 13:10
  • Has anyone managed to get android.provider.Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 600000); working with XE21.3? Still trying to get Compass to just stay on until the user dismisses it. – Doug Oct 06 '14 at 17:09
  • Non-privileged applications do not have permission to modify settings in `Settings.System`. The wake lock approach is the best way to go here. – Tony Allevato Oct 07 '14 at 22:53