Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24230] Android: Ti.TouchID fails on SDK < 23

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-01-08T23:03:28.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
Componentsn/a
Labelsfeedback
ReporterThomas Neerup
AssigneeHans Knöchel
Created2016-12-15T16:21:17.000+0000
Updated2017-01-11T18:32:22.000+0000

Description

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();
		}	
	}

Comments

  1. Sharif AbuDarda 2016-12-15

    Thanks for the ticket. Can you create a pull request for it? Our Engineers will take care it.
  2. Hans Knöchel 2016-12-17

    Hey Thomas, thanks for the great ticket! The isSupported fix is in the following ticket and the cancelAuthenticate has 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:
       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();
       
    2. Run the app on an Android device with API level < 23 Expected behavior: No crash!
  3. Samir Mohammed 2017-01-11

    Verified improvement, app no longer crashes and message for isSupported is displayed. *Environment*
       Appcelerator Command-Line Interface, version 6.1.0
       Ti.TouchID Module 2.0.2
       Samsung Galaxy Note II (Android 4.3)
       Nexus 6p (Android 7.1)
       Operating System Name: Mac OS X El Capitan
       Operating System Version: 10.11.6
       Node.js Version: 4.6.0
       npm: 4.2.8
       Titanium SDK Version: 6.1.0.v20170110133045
       Xcode: 8.2
       Appcelerator Studio: 4.8.1.201612050850
       

JSON Source