GDK - keep the screen from dimming on a live map

I have released a high-frequency live map, and I want the screen to not change when the user looks at the map.

I understand that this is a duplicate question for this

GDK / APK for Google Glass - save screen from dimming

but the answer does not seem to work anymore. Sample projects also do not remain on the screen. I also tried to get track lock without success.

Is there a way to save the screen?

+4
source share
3 answers

, , . LiveCard , Glass : LiveCard, , Glass .

, , Immersion, .

+4

, - .

//change screen timeout to 60 min
    android.provider.Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 600000);

:

<uses-permission android:name="android.permission.WRITE_SETTINGS"/>

, , , . , 19.1 Glass

+1

The only way that worked for me was to purchase wakeLock:

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK , TAG);
wakeLock.acquire(WAKE_LOCK_DURATION_IN_MILLIS);

You also need permission to do this:

<uses-permission android:name="android.permission.WAKE_LOCK" />
-1
source

Source: https://habr.com/ru/post/1524053/


All Articles