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)) {
6
CodeRank
Contextual code suggestions in your IDE  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() { 
6
CodeRank
Contextual code suggestions in your IDE  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; 
5
CodeRank
Contextual code suggestions in your IDE  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(); 
        } 
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  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();
5
CodeRank
Contextual code suggestions in your IDE  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();
	} 
} 
5
CodeRank
Contextual code suggestions in your IDE  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();
    } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:newKeyguardLock
 
    private void applyState(Context context) {
        if (mLock == null) {
            KeyguardManager keyguardManager = (KeyguardManager)
                    context.getSystemService(Context.KEYGUARD_SERVICE);
            mLock = keyguardManager.newKeyguardLock("PowerWidget");
        } 
        if (mDisabledLockscreen) {
            mLock.disableKeyguard();
        } else { 
            mLock.reenableKeyguard();
        } 
    } 
} 
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:newKeyguardLock
		disableKeyguard(context);
	} 
	 
    public void disableKeyguard(Context context) {
        KeyguardManager km = (KeyguardManager)context.getSystemService(context.KEYGUARD_SERVICE);
        KeyguardLock kgl = km.newKeyguardLock("ninja");
    	kgl.disableKeyguard();
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android KeyguardManager Questions & Answers:

See Code Examples for Android KeyguardManager Methods: