要顯示敏感資料,用戶可以在我的應用中啟用身份驗證。我正在使用
您可以從此處的設定到達那里:

我正在尋找的是這樣的:在這里,我們將用戶導航到其他一些 android 設定。
Intent intent2 = new Intent();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
intent2.setAction(android.provider.Settings.ACTION_APPLICATION_SETTINGS);
intent2.putExtra(android.provider.Settings.EXTRA_APP_PACKAGE, getPackageName());
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
intent2.setAction(android.provider.Settings.ACTION_APPLICATION_SETTINGS);
intent2.putExtra("app_package", getPackageName());
intent2.putExtra("app_uid", getApplicationInfo().uid);
} else {
intent2.setAction(android.provider.Settings.ACTION_APPLICATION_SETTINGS);
intent2.addCategory(Intent.CATEGORY_DEFAULT);
intent2.setData(Uri.parse("package:" getPackageName()));
}
startActivity(intent2);
uj5u.com熱心網友回復:
剛剛想通了。
有 3 個可行的選項可供使用:Settings.ACTION_BIOMETRIC_ENROLL、Settings.ACTION_FINGERPRINT_ENROLL 和 Settings.ACTION_SECURITY_SETTINGS。
我使用的最終實作是:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
activity.startActivity(new Intent(Settings.ACTION_BIOMETRIC_ENROLL));
}
else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
activity.startActivity(new Intent(Settings.ACTION_FINGERPRINT_ENROLL));
}
else {
activity.startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS));
}
}
Settings.ACTION_FINGERPRINT_ENROLL 打開這個:選擇備份鎖屏方法并設定選擇的方法后,設備會要求您注冊指紋。

Settings.ACTION_SECURITY_SETTINGS 打開這個:

由于缺少高于 Android Build "R" 的設備,我無法測驗 ACTION_BIOMETRIC_ENROLL,但我認為它類似于 ACTION_FINGERPRINT_ENROLL。
如果您想查看打開 android 設定的選項。您可以在 Android Studio 中的任何 Settings.XXX(ACTION_SECURITY_SETTINGS、ACTION_FINGERPRINT_ENROLL、...)上使用“CTRL” “滑鼠單擊”。然后你會看到“..\android\platforms\android-31\android.jar!\android\provider\Settings.class”

如果您難以確定使用“Build.VERSION_CODES.P”描述的 API 版本,您還可以在構建版本(P、O、...)上單擊“CTRL” “Mose Click”。然后你會看到這個:

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/418217.html
標籤:
下一篇:使用Vite代理的基本身份驗證
