我有一个在主页按钮上带有指纹传感器的设备。其他应用程序似乎可以识别并正确处理它,但是我正在构建的应用程序在以下几个步骤中失败了:
我正在使用android.support.v4.hardware.fingerprint.FingerprintManagerCompat
// at this point isHardwareDetected returns false
val fingerprintManager = FingerprintManagerCompat.from(context)
if (!fingerprintManager.isHardwareDetected) {
return false
}
如果我跳过硬件检测步骤,它仍然会失败
// hasEnrolledFingerprints returns false even tough there
// are couple of fingerprints registered
if (!fingerprintManager.hasEnrolledFingerprints()) {
return false
}
设备为UMI Plus E Android 6.0.1
这可能是什么问题?
另外,这是我有关指纹的清单:
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-feature android:name="android.hardware.fingerprint" android:required="false" />
修改
解决了此问题答案 0 :(得分:0)
这是github中指纹认证的简单示例,请检查并查看结果:
您也可以使用此辅助方法进行进一步的使用:
public static boolean isFingerprintDefined(@NonNull Context context) {
return FingerprintManagerCompat.from(context).isHardwareDetected() && FingerprintManagerCompat.from(context).hasEnrolledFingerprints();
}
答案 1 :(得分:0)
似乎更像是硬件问题,
Hardware not ready
等新指纹时出错,则表示硬件传感器有问题。答案 2 :(得分:0)
我记得很久以前,我遇到过同样的问题。这是支持库中的 Private Sub Worksheet_Change(ByVal Target As Range)
''-Select input cell here
If Not Intersect(Target, Range("A1")) Is Nothing Then
If Target.Value <> "" Then
''-Turns off visual updating
Application.ScreenUpdating = False
''-Returns value applied in input cell later used as row reference.
rwnum = Target.Value
Dim wb As Workbook
''Alt 1'For user selected workbook
'Dim dP As String
'dP = Environ$("USERPROFILE") & "\" & "Downloads": ChDrive "C:"
'ChDir dP
'Dim fNP As Variant
'fNP = Application.GetOpenFilename(FileFilter:="Excel Files (*.XLS), *.XLS", Title:="Select file")
'Set wb = Workbooks.Open(fNP)
''Alt 2'For static workbook name with static path
' Your path here '
Set wb = Workbooks.Open("C:\Users\Drew\Downloads\Weekly stats.xls")
''Alt 3'For static workbook name with semi dynamical path
'Set wb = Workbooks.Open(Environ$("USERPROFILE") & "\" & "Downloads\" & "Weekly stats.xls")
'C:\Users\UserName \ Downloads\ Weekly stats.xls
Dim rng As Range
Set rng = wb.ActiveSheet.Range("A1").CurrentRegion
''Alt 1'Static columns, select yours! 1=column A, 2=column B and so on..
c1 = 1: c2 = 2: c3 = 3: c4 = 4: c5 = 16
''Alt 2'Dynamic columns, if entire columns would move for some reason
'With rng
' c1 = WorksheetFunction.Match("Example header text 1", .Rows(1), 0)
' c2 = WorksheetFunction.Match("Example header text 2", .Rows(1), 0)
' c3 = WorksheetFunction.Match("Example header text 3", .Rows(1), 0)
' c4 = WorksheetFunction.Match("Example header text 4", .Rows(1), 0)
' c5 = WorksheetFunction.Match("Example header text 5", .Rows(1), 0)
'End With
Dim Mrng As Range
''-Where content is "pasted"
''Alt 1'Static destination
'Set Mrng = Me.Range("D2:S2")
''Alt 2'Same row as in closed workbook and columns 4 to 19(D:S)
'Set Mrng = Me.Cells(rwnum, 4).Resize(, 16)
''Alt 3'Next empty row in columns 4 to 19(D:S)
Set Mrng = Me.Range("D1048576").End(xlUp).Offset(1).Resize(, 16)
''-Adds the value to earlier selected columns in above selected row
With Mrng
.Cells(c1).Value = rng(rwnum, c1)
.Cells(c2).Value = rng(rwnum, c2)
.Cells(c3).Value = rng(rwnum, c3)
.Cells(c4).Value = rng(rwnum, c4)
.Cells(c5).Value = rng(rwnum, c5)
End With
''-Closes the "closed workbook" without saving any changes
wb.Close savechanges:=False
''-Returns selection to input cell for further testing
Target.Select
''-Turns on visual updating
Application.ScreenUpdating = True
End If
End If
End Sub
类的问题。尝试从平台上使用FingerprintManagerCompat
类,或将其更新为最新版本的支持库。