- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的应用程序中使用带指纹的锁屏。虽然它可以与其他具有指纹传感器的手机无缝协作,但三星用户正面临一些 SecurityException,正如我在我的谷歌控制台报告中看到的那样。报告如下:
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3319)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3415)
at android.app.ActivityThread.access$1100 (ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1821)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:148)
at android.app.ActivityThread.main (ActivityThread.java:7406)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
Caused by: java.lang.SecurityException:
at android.os.Parcel.readException (Parcel.java:1621)
at android.os.Parcel.readException (Parcel.java:1574)
at android.hardware.fingerprint.IFingerprintService$Stub$Proxy.hasEnrolledFingerprints (IFingerprintService.java:503)
at android.hardware.fingerprint.FingerprintManager.hasEnrolledFingerprints (FingerprintManager.java:776)
at com.example.ark.access.LockScreen.setUpFingerPrint (LockScreen.java:252)
at com.example.ark.access.LockScreen.onCreate (LockScreen.java:67)
at android.app.Activity.performCreate (Activity.java:6904)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1136)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3266)
这是我的文件中检查指纹的部分:
private void setUpFingerPrint(ImageView white,ImageView black)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
//Get an instance of KeyguardManager and FingerprintManager//
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
FingerprintManager fingerprintManager = (FingerprintManager) getSystemService(FINGERPRINT_SERVICE);
//Check whether the device has a fingerprint sensor//
if (!fingerprintManager.isHardwareDetected()) {
// If a fingerprint sensor isn’t available, then inform the user that they’ll be unable to use your app’s fingerprint functionality//
//Toast.makeText(this, R.string.noFingerPrint, Toast.LENGTH_SHORT).show();
white.setVisibility(View.GONE);
black.setVisibility(View.GONE);
}
//Check whether the user has granted your app the USE_FINGERPRINT permission//
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
// If your app doesn't have this permission, then display the following text//
Toast.makeText(this, R.string.noFingerPrintPermission, Toast.LENGTH_SHORT).show();
}
//Check that the user has registered at least one fingerprint//
if (!fingerprintManager.hasEnrolledFingerprints()) {
// If the user hasn’t configured any fingerprints, then display the following message//
Toast.makeText(this, R.string.noFingerPrintRegistered, Toast.LENGTH_SHORT).show();
}
//Check that the lockscreen is secured//
if (!keyguardManager.isKeyguardSecure()) {
// If the user hasn’t secured their lockscreen with a PIN password or pattern, then display the following text//
Toast.makeText(this, R.string.lockScreenNotConfigured, Toast.LENGTH_SHORT).show();
}
else {
try {
generateKey();
} catch (FingerprintException e) {
e.printStackTrace();
}
if (initCipher()) {
//If the cipher is initialized successfully, then create a CryptoObject instance//
FingerprintManager.CryptoObject cryptoObject = new FingerprintManager.CryptoObject(cipher);
// Here, I’m referencing the FingerprintHandler class that we’ll create in the next section. This class will be responsible
// for starting the authentication process (via the startAuth method) and processing the authentication process events//
int k = getIntent().getIntExtra("Mode", 0);
FingerprintHandler helper = new FingerprintHandler(this,k,white,black);
helper.startAuth(fingerprintManager, cryptoObject);
}
}
}
else
{
white.setVisibility(View.GONE);
black.setVisibility(View.GONE);
}
}
第 252 行是检查 fingerprintmanager.hasEnrolledFingerprints()
我很难搞清楚,因为我没有三星手机可以测试。到目前为止,它已经发生在 Galaxy J7 和 Grand Prime Plus 中。
最佳答案
不确定您是否曾经为此找到解决方案,作为一种解决方法,我只是将我们的调用包装在权限检查中。
inline val Activity.fingerprintManager: FingerprintManagerCompat?
get() = (
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.USE_FINGERPRINT) == PackageManager.PERMISSION_GRANTED) {
FingerprintManagerCompat.from(this)
} else { null }
)
关于android - 检查指纹是否已在三星手机中注册时出现 SecurityException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48542621/
我正在编写一个 C# 程序(具体来说是一个 IRC 机器人)并使用脚本库 Jint ( http://jint.codeplex.com/ )。我有一个外部命令链接到它,当调用它时,它会从另一个文件读
我有一个具有外部 API 的服务。在某些情况下我必须抛出 SecurityException。奇怪的事情如下:在某些 API 中,当我抛出异常时,绑定(bind)器成功完成此事务并且该异常被服务的经理
我有一个用 C# 编写的应用程序,它位于网络共享上。当我从本地驱动器运行它时,一切正常。当我从远程共享启动它时,调用像 try { System.Reflection.Assembly.Get
如果我自己的 DAO 类无法通过数据存储的身份验证,是否建议在其构造函数中抛出 SecurityException? Java 文档说 SecurityException 将由 SecurityMan
背景 我正在开发一款控制屏幕旋转的 Android 应用。 The app is available on the Google Play store .为了控制屏幕旋转,应用程序禁用了 system
这个问题在这里已经有了答案: Permission Denial: not allowed to send broadcast in android (4 个答案) 关闭 9 年前。 我的应用程序在
我尝试将位置服务作为后台服务运行。它在 Activity 中运行良好,但是当我使用服务时,我得到了 java.lang.securityException:客户端必须具有 ACCESS_COARSE_
我做了一个方法,当进度完成加载时发送本地通知,当我构建应用程序时,一切都清楚,没有任何错误/警告,我在发布 Google 控制台崩溃报告后收到了这个 通知方式如下: public void notif
我正在编写一个 Android 应用程序,作为该应用程序的一部分,我希望用户能够查看、选择和修改用户联系人。出于可用性原因(从用户方面),我的主要 Activity 扩展了 TabActivity。因
我在我的应用程序中使用带指纹的锁屏。虽然它可以与其他具有指纹传感器的手机无缝协作,但三星用户正面临一些 SecurityException,正如我在我的谷歌控制台报告中看到的那样。报告如下: java
我想制作一个能够将文件下载到计算机的小程序,然后在相关的编辑器中打开它们(当文件被保存时,应该会再次上传)。然而,在我花几个小时让它工作之前,我必须确保它实际上是可管理的(用 Java 桌面应用程序而
我的应用程序出现严重问题。我使用权限 android.permission.ACCESS_COARSE_LOCATION在广播接收器中,它运行完美。 但是在一定时间后(这似乎是随机的)应用程序崩溃并显
我在某些 API 6.0+ 设备上遇到以下崩溃: Fatal Exception: java.lang.SecurityException: Client must have ACCESS_COARS
我正在试验 Android AccountManager。 我有一个帐户身份验证服务,显示用于输入用户名/密码的 UI。 我转到设置/帐户/添加帐户,选择我的新帐户类型,然后我会看到 UI。 当我点击
使用此代码时出现上述错误: var userSettings = new UserSettings() { Username = TextBox
我似乎无法在 .NET 中写入事件日志。我得到以下异常: System.Security.SecurityException: The source was not found, but some o
我设计了一个函数,它可以从 SD 获取/设置资源,如果从 sd 中找不到,则从 Asset 中获取它,如果可能,将 Assets 写回 SD 此函数可以通过方法调用检查 SD 是否已安装且可访问...
FileStream 的 MSDN 构造函数表示它可能会抛出 UnauthorizedAccessException 或 SecurityException。以下是 MSDN 关于这些异常的说明。 U
我正在使用 Retrofit 的协程适配器,我发现,如果网络调用因为 URL 不正确而失败,则 try/catch block 将捕获它,但如果我删除 Internet 权限以便我们得到 Securi
我刚刚编写了一个 MVC 应用程序并让它在我的实验室中运行。现在我已将其部署到 GoDaddy,但收到以下错误。 Description: The application attempted to p
我是一名优秀的程序员,十分优秀!