Auto Lock Time

I already asked this question HERE before, but they misunderstood me. So now I try to be more explicit.

In the system settings of Android there is an option called "Automatically block." The default value is 5 seconds. I need to get this value programmatically.

Before you marked my question as a duplicate IT question, but this is not the same.

To be more clear, I put here 2 screenshots:

This is what I need ("Automatically block"):

What i need "Automatically lock"

This is what

    Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, DELAY); 

coming back. ("Dream")

What you think i need

Hope this is more clear.

Thanks!

+4
source share
3 answers

Try

Settings.Secure.getLong(getContentResolver(), "lock_screen_lock_after_timeout", 5000);
+2

to srzdev advice !

    int time = Settings.Secure.getInt(getContentResolver(), "lock_screen_lock_after_timeout", 5000);

, Android, 4.2 4.3, !

+2
 private static final int DELAY = 3000;
    int defTimeOut = 0;    

defTimeOut = Settings.System.getInt(getContentResolver(), 
                             Settings.System.SCREEN_OFF_TIMEOUT, DELAY);

            Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, DELAY);
-1
source

All Articles