首页 > 解决方案 > Redmi 上的 Intent ACTION_FINGERPRINT_ENROLL 导致异常

问题描述

在小米红米 Note 9 Pro 上,我们尝试使用以下代码打开指纹注册:

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

这导致以下异常

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.

我们在 a 中调用代码,try/catch但它仍然使我们最重要的活动崩溃。

我是否被迫在我的应用程序中使用 miui 主题来启动指纹注册?不能将我们的应用主题更改为 miui 主题来解决此问题。

是否有小米推出的特殊意图动作或其他实现指纹登记的方式?

使用Intent(Settings.ACTION_SECURITY_SETTINGS)打开安全设置并不能解决问题,因为似乎没有可用于添加指纹的选项

标签: androidexceptionandroid-intentandroid-fingerprint-apiredmi-device

解决方案


推荐阅读