Skip to content

Instantly share code, notes, and snippets.

@moonjuice
Created November 7, 2018 17:11
Show Gist options
  • Save moonjuice/76504f7fb97066c85cdd3952e04efe55 to your computer and use it in GitHub Desktop.
Save moonjuice/76504f7fb97066c85cdd3952e04efe55 to your computer and use it in GitHub Desktop.
//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