Android KeyguardManager.KeyguardLock - 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.KeyguardLock class.

This code example shows how to use the following methods:disableKeyguard
This code example shows how to use the following methods:disableKeyguard, reenableKeyguard
This code example shows how to use the following methods:disableKeyguard, reenableKeyguard
            msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2);
            msg.show();
        } else { 
            getLock(context);
            if (lockScreen && lock != null) {
                lock.disableKeyguard();
                lockScreen = false;
                // writeState(context); 
            } else if (lock != null) {
                lock.reenableKeyguard();
                lockScreen = true;
                // writeState(context); 
            } 
        } 
    } 
 
    /** 
     * Gets the state of GPS location. 
     * 
     * @param context 
6
CodeRank
This code example shows how to use the following methods:disableKeyguard, reenableKeyguard
This code example shows how to use the following methods:disableKeyguard
This code example shows how to use the following methods:disableKeyguard, reenableKeyguard
            msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2);
            msg.show();
        } else { 
            getLock(context);
            if (lockScreen && lock != null) {
                lock.disableKeyguard();
                lockScreen = false;
            } else if (lock != null) {
                lock.reenableKeyguard();
                lockScreen = true;
            } 
        } 
    } 
 
    /** 
     * Gets the state of GPS location. 
     * 
     * @param context 
     * @return true if enabled. 
     */ 
5
CodeRank
This code example shows how to use the following methods:disableKeyguard
			KeyguardManager mKeyGuardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); 
			KeyguardLock mLock = mKeyGuardManager.newKeyguardLock("activity_classname"); 
			 
			switch (state) { 
			case TelephonyManager.CALL_STATE_RINGING: 
				mLock.disableKeyguard(); 
				break; 
			case TelephonyManager.CALL_STATE_IDLE: 
				mLock.reenableKeyguard(); 
				break; 
			} 
		} 
	}; 
	 
	@Override 
	public int onStartCommand(Intent intent, int flags, int startId) {
        Notification.Builder builder = new Notification.Builder(getApplicationContext());
        Intent i = new Intent(this, MainActivity.class);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 1, i, Intent.FLAG_ACTIVITY_CLEAR_TASK);
        builder.setContentTitle("AOSP Call Workaround");
4
CodeRank
This code example shows how to use the following methods:disableKeyguard
	public void onCreate() { 
		super.onCreate(); 
		mActionReceiver.register(this, ACTION_CHECK);
		mKeyguard = ((KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE)).newKeyguardLock("KEYGUARD");
		mScreen = ((PowerManager) getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.FULL_WAKE_LOCK, "SCREEN");
		mKeyguard.disableKeyguard();
		mScreen.acquire();
	} 
 
	@Override 
	public void onDestroy() { 
		mActionReceiver.unregister(this);
		mKeyguard.reenableKeyguard();
		mScreen.release();
		super.onDestroy(); 
	} 
 
} 
4
CodeRank
This code example shows how to use the following methods:disableKeyguard
						"WAKEUP"); 
		wakeLock.acquire();
		KeyguardManager keyguardManager = (KeyguardManager) getApplicationContext()
				.getSystemService(Context.KEYGUARD_SERVICE);
		keyguardLock = keyguardManager.newKeyguardLock("KEYBOARD DISABLE");
		keyguardLock.disableKeyguard();
		Log.e("SERVCE","STARTED");
		Toast.makeText(getApplicationContext(), "STARTED SERVICE",
				Toast.LENGTH_SHORT).show();
		SystemClock.sleep(5000);
		stopSelf();
	} 
 
	@Override 
	public void onDestroy() { 
		Toast.makeText(getApplicationContext(), "STOPED SERVICE",
				Toast.LENGTH_SHORT).show();
		Log.e("SERVCE","STOPED");
		keyguardLock.reenableKeyguard();
	} 
4
CodeRank
This code example shows how to use the following methods:disableKeyguard
    // Start listening for the screen to turn on and off when SkiPhone is 
    // enabled. 
    if (intent.hasExtra(SkiPhoneService.IS_ENABLED_EXTRA)) { 
      if (intent.getBooleanExtra(IS_ENABLED_EXTRA, false)) { 
        // Disable the keyguard. 
        keyguardLock.disableKeyguard(); 
 
        // Listen for the screen to turn on and off. 
        registerReceiver(screenReceiver, screenIntentFilter); 
 
        // Show a status bar notification. 
        showNotification(); 
 
        // Save shared preferences. 
        saveEnabledState(true); 
      } else { 
        disableSkiPhone(); 
        return; 
      } 
    } 
4
CodeRank

Related Android KeyguardManager.KeyguardLock Questions & Answers:

See Code Examples for Android KeyguardManager.KeyguardLock Methods: