[英]Creating custom screen and keypad unlock android
我正在尝试创建一个带有解锁选项的自定义android屏幕(基本上是覆盖默认解锁屏幕并覆盖幻灯片解锁按钮的东西)。 解锁后,它应直接进入键盘以输入密码并以默认方式运行。 我尝试使用小部件创建此文件,但无法找到添加此内容的方法,例如解锁屏幕。 任何帮助将不胜感激。我正在使用android studio。
这是您正在寻找的好例子。 https://github.com/googlesamples/android-ConfirmCredential
private void showAuthenticationScreen() {
// Create the Confirm Credentials screen. You can customize the title and description. Or
// we will provide a generic one for you if you leave it null
Intent intent = mKeyguardManager.createConfirmDeviceCredentialIntent(null, null);
if (intent != null) {
startActivityForResult(intent, REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS);
}
}
这是用于结果和获得身份验证的开放意图的小代码。 但是我建议尝试下载代码并进行查看。
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS) {
// Challenge completed, proceed with using cipher
if (resultCode == RESULT_OK) {
if (tryEncrypt()) {
showPurchaseConfirmation();
}
} else {
// The user canceled or didn’t complete the lock screen
// operation. Go to error/cancellation flow.
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.