[TIMOB-19376] Android: Fingerprint support
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-07-27T18:55:50.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 6.0.0 |
Components | Android |
Labels | parity, touchid |
Reporter | Chee Kiat Ng |
Assignee | Ashraf Abu |
Created | 2015-08-19T04:53:08.000+0000 |
Updated | 2017-01-04T10:53:22.000+0000 |
Description
Android M supports fingerprint authentication. Refer to
http://developer.android.com/preview/api-overview.html
and https://github.com/googlesamples/android-FingerprintDialog
Try to achieve parity and package with ti.touchid module.
Attachments
File | Date | Size |
---|---|---|
2016_07_08_15_38_38.mp4 | 2016-07-08T22:47:30.000+0000 | 3079567 |
Screenshot_20160727-155415.png | 2016-07-27T07:59:09.000+0000 | 98219 |
Did any body find a solution for Android touchid fingerprint authentication using ti.touchid or any other module built for Appcelerator Titanium ?
I'm looking for Android TouchID module as well. Any Update from Appcelerator ? or anyone created module already ?
When we can expect this module ?
We are working on it. See Fix Release version. Do also note that the only devices that support this is Nexus 5x and 6p.
PR: https://github.com/appcelerator-modules/ti.touchid/pull/18
PR reviewed and merged.
PR (titanium_mobile/master): https://github.com/appcelerator/titanium_mobile/pull/8017
[~titanium@webmasterei-hamburg.de] tested the module in master and had some trouble we might want to address: {quote} 1. He needed to rebuild, because a jar was missing 2. He needed to set the permissions
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
manually (can we put it into timodule.xml?? At least we should leave a comment about it in the example) 3. The module must be required after opening a window/activity 4. TiTouchId.isSupported() always returnstrue
? (5. We should start to create a README.md for that project to note those infos) {quote}For usage with old API levels we need a method like
getAuthorisationOrTrueIfOldVersion()
for usage the same async structur. These helper functions has different output, maybe it is a good idea to make in same style: [INFO] : isSupported()=true [INFO] : {"canAuthenticate":true}Thanks [~hansknoechel], I'll look into these issues.
1. Which jar is missing? 2. The permission should already be in timodule.xml: https://github.com/appcelerator-modules/ti.touchid/blob/master/android/timodule.xml#L11 3. What do you mean? It doesn't work if you do require("touch.id") before you open a window? That doesn't sound right. 4. This will return false on devices that doesn't have fingerprint support. There are currently only Nexus 5x and 6p that support this feature.
1. Hans sent me azip of module. After including and usage came an error "jat not found" and I have recomplied => without error at runtime 2. you are right, I forgot to copy 3. I have embed the module at "construction time" of window and a weird error message came. Then I have embed the code after open event of activity and the error disappeared. 4. if the module should run in all devices and the critical action is inside the async node, then it is a good idea to offer a dummy method. In other case the coder must implement a logic to realize this. (similar this wrapper: https://gist.github.com/AppWerft/6ba7b7ba8d14a269bb05f1b319d754f4)
[~titanium@webmasterei-hamburg.de], which error did you see on 3?
I see the following issues running the example app from the module: 1. I click on
Authenticate
& place my correct finger on the fingerprint reader. 2. I get alertYAY! success
. 3. I click on authenticate again & place the incorrect finger on the fingerprint reader. 4. I get alertMessage:Unable to recognize fingerprint
. 5. I clickAuthenticate
again. 6. I get alertMessage: Fingerprint operation cancelled
. I get this as long as I keep scanning my wrong finger. 7. If I place my correct finger on the fingerprint scanner it scans & I get a success. Attached a video for this issue: [^2016_07_08_15_38_38.mp4] Reopening as of now. Environment: Appc Studio : 4.7.0.201607070843 Ti SDK : 5.4.0.v20160705213725 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.5 Appc NPM : 4.2.8-1 Appc CLI : 5.4.0-28 Node: 4.4.4 Nexus5X: Android 6.0.1[~lchoudhary] I assume the expected behaviour for number 6 would be the same results as number 4?
[~msamah], 1. Everything works fine until
step 4
. 2. Atstep 5
I again clickauthenticate
& I after clickingauthenticate
I get alertMessage: Fingerprint operation cancelled
. 3. I keep on getting thisMessage: Fingerprint operation cancelled
until I scan my correct finger. So basically, after a failure it will keep showing you alertMessage: Fingerprint operation cancelled
every time I clickauthenticate
, until you scan the correct finger (FYI, at this step even though you get an alertMessage: Fingerprint operation cancelled
the scanner can still scan the finger.)[~lchoudhary] This is actually expected behaviour. What's happening is that at step 4, once you get an
Unable to recognize fingerprint
, you should not press authenticate again. Instead, you should just provide another fingerprint for the sensor to read. Ideally it should instead show a blocking dialog UI for the fingerprint. Be it success or failure. This is because it is waiting till you provide a correct fingerprint and will stay there even at failure. (You might have a dirty finger after all and need to clean it. Thus it lets you read it again). !Screenshot_20160727-155415.png|thumbnail! I would suggest that we resolve this ticket (and perhaps document this) as it is and create a ticket for a improvement on this flow. [~lchoudhary] Reference https://github.com/googlesamples/android-FingerprintDialog[~lchoudhary] If my idea is acceptable please resolve this issue.
[~msamah] Can we make a tiny doc-note for that? Guess it's fine then.
Ya. I'll proceed with a doc.
Doc PR: https://github.com/appcelerator-modules/ti.touchid/pull/21 [~hansknoechel] For your review.
Merged. Please also consider to update the pre-packaged, although it's only a docs update.
The behaviour seems to be as expected. Verified the addition of doc note. Closing. Environment: Appc Studio : 4.7.0.201607111053 Ti SDK : 5.4.0.v20160725003348 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.5 Appc NPM : 4.2.8-1 Appc CLI : 5.4.0-34 Node: 4.4.4 Nexus 5X - Android 6.0.1
Reopening to correct comment
Created ticket MOD-2278 for the improvement mentioned here.
For document update: Updated module PR: https://github.com/appcelerator-modules/ti.touchid/pull/22 Added to release: https://github.com/appcelerator-modules/ti.touchid/releases/tag/android-2.0.1 Ti SDK PR: https://github.com/appcelerator/titanium_mobile/pull/8166
PRs merged.
Using of version 2.0.1 (compiled with SDK6.0.0) doesn't show any UI. testes devices: Galaxy6Edge with M and ZTEBlade7 with M.
[~titanium@webmasterei-hamburg.de] See the mentioned ticket (MOD-2278) for this, we discussed it earlier. The current Touch ID implementation on Android does not seem to have a UI expected. Feel free to add this functionality on Android as well.
Addition: And it is not natively supported. All that the [Google sample](https://github.com/googlesamples/android-FingerprintDialog) does is to create a custom UI to mock this behavior. Developers usually create their own UI on Android, see [this](http://blog.m2sys.com/wp-content/uploads/2015/11/Android-fingerprint.jpg) and [this](http://cdn.bgr.com/2015/05/dashlane-android-m-fingerprint-support.jpg?quality=98&strip=all) example as well.
In this case a modified example/app.js is meaningful. This irritates me: after start of
authenticate
comes immediately the error message ("Cancel by user"). I could create a dialog with text/image, but how handle, if the function doesn't wait.This works for me:
This are possible payloads from callback: {"message":"GurgsDNfmFvbkiR6IK0atg==\n","success":true} {"error":"Unable to recognize fingerprint","success":false} {"error":"Fingerprint operation canceled.","success":false} Maybe we need an integer result code to better analyze the result. In FingerPrintHelper.java#115 we need an additional property "code" and in 124, 131,140 modifications. next time I will send a PR.
I have a PR done. It adds resultcodes to every callback (for i18n) and exposed the helpers/hints like "Make sure that your finger covers the entire Home key" or "Keep your finger on the Home key a little longer" with resultcode. A list of new constants is added.
For UI look to this [gist](https://gist.github.com/AppWerft/53469996b2a0589a037d2622fea6eb65) !https://github.com/AppWerft/ti.touchid/blob/master/android/assets/fingerprintDialog_screenshot.png!