Created
November 7, 2018 17:11
-
-
Save moonjuice/76504f7fb97066c85cdd3952e04efe55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//region [in some funtion] | |
if (keyguardManager.isKeyguardLocked()) { | |
// custom title and some description | |
Intent intent = keyguardManager.createConfirmDeviceCredentialIntent("My Title", "A Custom Description"); | |
if (intent != null) { | |
startActivityForResult(intent, REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS); | |
}else{ | |
Toast.makeText("Secure lock screen hasn't set up").show(); | |
} | |
} | |
//endregion | |
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
if (requestCode == REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS) { | |
if (resultCode == RESULT_OK) { | |
Toast.makeText("Success").show(); | |
} else { | |
Toast.makeText("Cancel").show(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment