Android KeyguardManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android KeyguardManager class.

This code example shows how to use the following methods: newKeyguardLock
This code example shows how to use the following methods: newKeyguardLock
	public void disableKeyguard(Activity activity) {
		if (mKeyguardLock != null) {
			mKeyguardLock.disableKeyguard();
		} else { 
			KeyguardManager keyguardManager = (KeyguardManager) activity.getSystemService(Activity.KEYGUARD_SERVICE);
			mKeyguardLock = keyguardManager.newKeyguardLock(KEYGUARD_TAG);
			mKeyguardLock.disableKeyguard();
		} 
	} 
	 
	public void enableKeyguard() { 
		if (mKeyguardLock != null) {
			mKeyguardLock.reenableKeyguard();
		} 
		mKeyguardLock = null;
	} 
 
 
	public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
		if (key.equals(PREF_KEYGUARD_DISABLED)) {
Full Snippet Info
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: newKeyguardLock
        mImm = InputMethodManager.getInstance(mTargetActivity);
 
        KeyguardManager keyguardManager =
            (KeyguardManager) getInstrumentation().getContext().getSystemService(
                    Context.KEYGUARD_SERVICE);
        keyguardManager.newKeyguardLock("imftest").disableKeyguard();
    } 
     
    // Utility test methods 
    public void verifyEditTextAdjustment(final View editText, int rootViewHeight) {
 
        int[] origLocation = new int[2];
        int[] newLocation = new int[2];
 
        // Tell the keyboard to go away. 
        mImm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
 
        // Bring the target EditText into focus. 
        mTargetActivity.runOnUiThread(new Runnable() {
            public void run() { 
Full Snippet Info
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: inKeyguardRestrictedInputMode
        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        if (!pm.isScreenOn()) {
            return false; 
        } 
        KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
        if (km.inKeyguardRestrictedInputMode()) {
            return false; 
        } 
        return true; 
    } 
 
    public static void assertViewVisible(View v) {
        if (v == null) {
            throw new NullPointerException();
        } 
        for (;;) { 
            assertTrue("visibility for " + v, View.VISIBLE == v.getVisibility());
            ViewParent parent = v.getParent();
            if (parent == null || !(parent instanceof View)) {
                break; 
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: isKeyguardLocked
        this.stopService(serviceIntent);
    } 
 
    private void keyguardStop() { 
        boolean screenLocked =
                mKeyguardManager != null && mKeyguardManager.isKeyguardLocked();
        if (!screenLocked) {
            stopService(); 
        } 
    } 
} 
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: inKeyguardRestrictedInputMode, isKeyguardSecure, newKeyguardLock
    } 
 
    public static synchronized void disableKeyguard(Context context) {
        initialize(context);
 
        if (mKeyguardManager.isKeyguardSecure()) {
            return; 
        } 
 
        if (mKeyguardManager.inKeyguardRestrictedInputMode()) {
            mKeyguardLock = mKeyguardManager.newKeyguardLock(LOGTAG);
            mKeyguardLock.disableKeyguard();
        } else { 
            mKeyguardLock = null;
        } 
    } 
 
    public static synchronized boolean inKeyguardRestrictedInputMode() { 
        if (mKeyguardManager != null) {
            return mKeyguardManager.inKeyguardRestrictedInputMode();
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: inKeyguardRestrictedInputMode, newKeyguardLock
		setContentView(view.getView());
	} 
 
	private void disableKeyGuard() { 
		KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
		KeyguardManager.KeyguardLock lock = keyguardManager.newKeyguardLock(getClass().getName());
		if (keyguardManager.inKeyguardRestrictedInputMode()) {
			lock.disableKeyguard();
		} 
	} 
 
	@Override 
	public void onBackPressed() { 
		view.onBackPressed();
	} 
} 
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: isKeyguardLocked, isKeyguardSecure
 
    private boolean isKeyguardLocked() { 
        KeyguardManager kgm = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
        if (LOGV) {
            if (kgm != null) {
                Log.v(TAG, "kgm.isKeyguardLocked()="+kgm.isKeyguardLocked()
                        + ". kgm.isKeyguardSecure()="+kgm.isKeyguardSecure());
            } 
        } 
        // isKeyguardSecure excludes the slide lock case. 
        return (kgm != null) && kgm.isKeyguardLocked() && kgm.isKeyguardSecure();
    } 
} 
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: newKeyguardLock
This code example shows how to use the following methods: newKeyguardLock

Related Android KeyguardManager Questions & Answers:

See Code Examples for Android KeyguardManager Methods: