2
votes

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

1
It is a setting...you can turn off the sleep lock if you scroll over to your settings. It is in there! - Alex K
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

1 Answers

1
votes

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.