You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-12Lines changed: 22 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,20 +69,30 @@ class MyClass {
69
69
Note that on the iOS simulator this will just `resolve()`.
70
70
71
71
```js
72
-
fingerprintAuth.verifyFingerprint({
73
-
title:'Android title', // optional title (used only on Android)
74
-
message:'Scan yer finger', // optional (used on both platforms) - for FaceID on iOS see the notes about NSFaceIDUsageDescription
75
-
authenticationValidityDuration:10// optional (used on Android, default 5)
76
-
}).then(
77
-
function() {
78
-
console.log("Fingerprint was OK");
79
-
},
80
-
function() {
81
-
console.log("Fingerprint NOT OK");
82
-
}
83
-
)
72
+
fingerprintAuth.verifyFingerprint(
73
+
{
74
+
title:'Android title', // optional title (used only on Android)
75
+
message:'Scan yer finger', // optional (used on both platforms) - for FaceID on iOS see the notes about NSFaceIDUsageDescription
76
+
authenticationValidityDuration:10, // optional (used on Android, default 5)
77
+
useCustomAndroidUI:false// set to true to use a different authentication screen (see below)
78
+
})
79
+
.then(() =>console.log("Biometric ID OK"))
80
+
.catch(err=>console.log(`Biometric ID NOT OK: ${JSON.stringify(err)}`));
84
81
```
85
82
83
+
#### A nicer UX/UI on Android (`useCustomAndroidUI: true`)
84
+
The default authentication screen on Android is a standalone screen that (depending on the exact Android version) looks kinda 'uninteresting'. So with version 6.0.0 this plugin added the ability to override the default screen and offer an iOS popover style which you can activate by passing in `useCustomAndroidUI: true` in the function above.
85
+
86
+
##### Mandatory change
87
+
To be able to use this screen, a change to `App_Resources/Android/AndroidManifest.xml` is required as our NativeScript activity needs to extend AppCompatActivity (note that in the future this may become the default for NativeScript apps).
88
+
89
+
To do so, open the file and replace `<activity android:name="com.tns.NativeScriptActivity"` by `<activity android:name="org.nativescript.fingerprintplugin.AppCompatActivity"`.
90
+
91
+
Note that if you forget this and set `useCustomAndroidUI: true` the plugin will `reject` the Promise with a relevant error message.
92
+
93
+
##### Optional change
94
+
If you want to override the default texts of this popover screen, then drop a file `App_Resources/Android/values/strings.xml` in your project and override the properties you like. See the demo app for an example.
95
+
86
96
### `verifyFingerprintWithCustomFallback` (iOS only, falls back to `verifyFingerprint` on Android)
87
97
Instead of falling back to the default Passcode UI of iOS you can roll your own.
88
98
Just show that when the error callback is invoked.
<stringname="fingerprint_hint">Touch da sensor</string>
15
+
16
+
<!-- Error messages -->
17
+
<stringname="fingerprint_auth_not_available_msg"><![CDATA[\"Secure lock screen hasn\'t set up.\\n\" + \"Go to \'Settings -> Security -> Fingerprint\' to set up a fingerprint\"]]></string>
18
+
<stringname="fingerprint_auth_not_enrolled_msg">Go to \'Settings -> Security -> Fingerprint\' and register at least one fingerprint</string>
19
+
<stringname="fingerprint_not_initialised_error_msg">Fingerprint not initialised</string>
20
+
<stringname="fingerprint_not_available_error_msg">Fingerprint not available</string>
21
+
<stringname="fingerprint_not_recognized_error_msg">Fingerprint not recognized</string>
22
+
<stringname="warning_password_empty">Password can\'t be empty</string>
<Labeltext="Scanning the fingerprint / face"class="title"/>
16
16
<Labeltext="When scanning fails or is not possible, you can either use the built-in passcode fallback or handle it yourself (custom fallback)."textWrap="true"/>
17
17
<Buttontext="verify with passcode fallback"tap="{{ doVerifyFingerprint }}"class="button" />
18
-
<Buttontext="verify with custom fallback"tap="{{ doVerifyFingerprintWithCustomFallback }}"class="button" />
18
+
<iOS>
19
+
<Buttontext="verify with custom fallback"tap="{{ doVerifyFingerprintWithCustomFallback }}"class="button" />
20
+
</iOS>
21
+
<Android>
22
+
<Labeltext="Note that this will fail if you previously cancelled authentication with the button above. Try reinstalling the app if funny things happen."textWrap="true"/>
23
+
<Buttontext="verify with custom UI"tap="{{ doVerifyFingerprintWithCustomUI }}"class="button" />
0 commit comments