Intent to launch fingerprint enrollment screen

夙愿已清 提交于 2019-12-23 07:29:15

问题


How to launch finger print enrollment settings screen(Add fingerprint screen) from my app?

After enrolling finger print, is there any way to navigate back to my application? (with startActivityForResult)


回答1:


After reading the docs, I found out that as of now, there is no such intent action available. I launched the security settings(where fingerprints option available) with the below Intent.

startActivity(new Intent(android.provider.Settings.ACTION_SECURITY_SETTINGS));



回答2:


with API >= P there is Settings.ACTION_FINGERPRINT_ENROLL & BiometricPrompt.

@RequiresApi(api = Build.VERSION_CODES.P)
private void startFingerprintEnrollment(@NonNull AppCompatActivity activity) {
    Intent intent = new Intent(Settings.ACTION_FINGERPRINT_ENROLL);
    activity.startActivityForResult(intent, REQUESTCODE_FINGERPRINT_ENROLLMENT);
}

compared to API >= M:

@SuppressWarnings("deprecation")
@RequiresApi(api = Build.VERSION_CODES.M)
private void gotoSecuritySettings(@NonNull AppCompatActivity activity) {
    Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
    activity.startActivityForResult(intent, REQUESTCODE_SECURITY_SETTINGS);
}

think this is the FingerprintEnrollIntroduction ...

onboarding activity for fingerprint enrollment.




回答3:


Suggested answer won't work for example on Huawei P9. Fingerprint settings on this model is available from: startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));.

Another thing is that when you launch system settings on your app task, enroll new fingerprint and return by back press you won't be able to encrypt any message on first authorization. The best thing is if user set app to background and enroll finger on his own, then restore app, encrypting will work. I have no idea what is the reason of such behaviour, so I suggest to just inform user about posibility of enroll finger.



来源:https://stackoverflow.com/questions/39526631/intent-to-launch-fingerprint-enrollment-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!