isSupported() method fails with null pointer exception when used on SDK < 23.
Module is missing method for canceling probing for fingerprints
I have included my fix for TouchidModule.java:
@Kroll.method
public boolean isSupported() {
/* Added SDK check to avoid null pointer Exception */
if (Build.VERSION.SDK_INT >= 23) {
return mfingerprintHelper.isDeviceSupported();
}
return false;
}
/* New method to cancel probing for fingerprints */
@Kroll.method
public void cancelAuthenticate() {
if (mfingerprintHelper != null) {
mfingerprintHelper.stopListening();
}
}
Thanks for the ticket. Can you create a pull request for it? Our Engineers will take care it.
Hey Thomas, thanks for the great ticket! The
isSupportedfix is in the following ticket and thecancelAuthenticatehas been added to [this PR](https://github.com/appcelerator-modules/ti.touchid/pull/23), since iOS will also support it in the next feature version. Thx! PR: https://github.com/appcelerator-modules/ti.touchid/pull/24 Packaged module: https://github.com/appcelerator-modules/ti.touchid/releases/tag/android-2.0.2 Note: I bumped to 2.0.2 for SDK release 6.1.0, but with the other PR already bumping to 2.1.0, we'll probably have the 2.1.0 (iOS / Android) for 6.1.0 instead, incorporating all changes. Test-case: 1. Create an app with the following content:2. Run the app on an Android device with API level < 23 Expected behavior: No crash!var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); var btn = Ti.UI.createButton({ title: 'Check isSupported()' }); btn.addEventListener('click', function() { var TiTouchID = require('ti.touchid'); alert('Supported: ' + TiTouchID.isSupported()); }); win.add(btn); win.open();Verified improvement, app no longer crashes and message for
isSupportedis displayed. *Environment*