2

On a Xiaomi Redmi Note 9 Pro we try to open the fingerprint enrollment with the following code:

val intent = Intent(Settings.ACTION_FINGERPRINT_ENROLL)
startActivityForResult(intent, SETTINGS_FINGERPRINT_ENROLLMENT_REQUESTCODE)

This result in the following exception

java.lang.RuntimeException: 
Unable to start activity ComponentInfo{com.android.settings/com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroduction}: 
java.lang.IllegalStateException: 
You need to use a miui theme (or descendant) with this activity.

We call the code in a try/catch but it still crashes our top most activity.

Am I forced to use the miui theme in my app to start the fingerprint enrollment? It's not an option to change our app theme to miui theme to fix this issue.

Is there a special intent action introduced by Xiaomi or another way of achieving the fingerprint enrollment?

Using Intent(Settings.ACTION_SECURITY_SETTINGS) to open the security settings does not solve the problem since it seems that there is no option available to add a fingerprint

Aaron
  • 413
  • 5
  • 13
  • That error feels like it is coming from `com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroduction`, not from your code. Are you able to enroll fingerprints from Settings anywhere (navigating as a user, not via your app)? – CommonsWare Jul 22 '21 at 12:29
  • Have you tried this? https://stackoverflow.com/a/53271236/932052 - might be WRT Android version – Quintin Balsdon Jul 22 '21 at 12:47
  • @CommonsWare Yes, the exception is thrown after calling `startActivityForResult()`. It can confirm that it happens outside of our code. My assumption is that Xiaomi has modified the Android system and corrupted it. – Aaron Jul 22 '21 at 13:16
  • @QuintinBalsdon Yes, we check the Android version and only use `ACTION_FINGERPRINT_ENROLL` if it is >= 28 otherwise open the security settings. – Aaron Jul 22 '21 at 13:18
  • 1
    I am also facing the same error on the same device. @CommonsWare, does any of you has any solution for this? – Raghul Vaikundam Oct 04 '21 at 08:32

0 Answers0