Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24413] Android: Ti.TouchID crashes app on unsupported devices

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-03-13T16:41:22.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsandroid, module, ti.touchid
ReporterAndrea Jonus
AssigneeGary Mathews
Created2017-02-17T08:46:56.000+0000
Updated2017-08-31T07:54:10.000+0000

Description

Ti.TouchID causes a crash on Android devices that don't support fingerprint authentication, or where any fingerprint hasn't been added yet. In such devices, the constructor for FingerPrintHelper throws an exception, and every subsequent reference to the object triggers an error of this kind:
JNI ERROR (app bug): attempt to use stale global reference
*Steps to reproduce:* - Create a Titanium app that requires ti.touchid - Install on a Android device with no fingerprint added by the user - Call any method of ti.touchid

Comments

  1. Hans Knöchel 2017-02-17

    Can you try the [Ti.TouchID 2.1.0](https://github.com/appcelerator-modules/ti.touchid/releases/tag/android-2.1.0) version on Android? One of the fixes was exactly for that. In general: Follow Github repos for those updates, since patches are available there before they are distributed with the SDK (2.1.0 will be prepackaged in SDK 6.1.0).
  2. Andrea Jonus 2017-02-17

    I'm currently using the 2.1.0 version. Sorry, i forgot to add the module version in the description. I saw https://github.com/appcelerator-modules/ti.touchid/pull/24 and https://github.com/appcelerator-modules/ti.touchid/pull/25 , but i don't think they cover this case.
  3. Hans Knöchel 2017-02-17

    But if you check with TouchID. isSupported() and it returns false, you shouldn't call any of the other methods. That's why we have that method exposed. Or do I understand something wrong?
  4. Andrea Jonus 2017-02-17

    The problem is that the app crashes when calling ANY method of TouchID when the device is not supported, INCLUDING TouchID.isSupported().
  5. Hans Knöchel 2017-02-17

    All others are supposed to fail, otherwise we would need to guard all method as well, which would result in a duplicated check. I'm still wondering why isSupported() crashes though. Let us check that, moving to TIMOB.
  6. Hans Knöchel 2017-02-24

    Community PR: https://github.com/appcelerator-modules/ti.touchid/pull/27
  7. Andy Waldman 2017-02-27

    [~hansknoechel] Hi Hans I was wondering whether this is an open ticket or the ticket is needing to be reviewed ?
  8. Hans Knöchel 2017-02-27

    [~awaldman] It's open and assigned to [~gmathews], so he'll probably put it into review when he reviews it :-)
  9. Lokesh Choudhary 2017-03-15

    Checked the fix by building the ti.touchid module from source & the app does not crash on unsupported devices. Closing. Appc Studio : 4.8.1.201612050850 SDK Version : 6.1.0.v20170315131319 Mac OS Version : 10.12.3 Xcode Version : Xcode 8.2.1 Build version 8C1002 Appc CLI AND Appc NPM : {"NPM":"4.2.8","CLI":"6.1.0"} Ti CLI : 5.0.11 Alloy : 1.9.5 Node : v4.6.0 Device: running 7.1.1Pixel, Nexus 6 android 6.0.1
  10. Gary Mathews 2017-06-30

    [~aislam] Updated the 2.2.0 pre-release .zip, please re-download and try again?
  11. Aminul Islam 2017-06-30

    Hi, Unable to reproduce that error with updated the 2.2.0 pre-release and latest SDK 6.1.1.GA on Android 6 (HTC one).
  12. Snigdha Nooli 2017-08-30

    Hi, This issue is not resolved with 6.1.0 GA. We are still facing the issue when trying to access any of the methods of ti.touchId module. Application is crashing when trying to access any method of touchid module on devices which does not support touch id. SDK : 6.1.2 GA Crashing on Devices : Nexus 7 (6.0.0) , Moto G3 (6.0.0)
  13. Hans Knöchel 2017-08-30

    [~Snigdha.Nooli] Please sure you use the latest module-version ([here](https://github.com/appcelerator-modules/ti.touchid/releases/tag/android-2.2.0), includes some more enhancements since then). The fix-version 6.1.0 just means that the updated module is included in that SDK, but you may still want to manually reference it in case you are running into issues. Example to ensure Ti.TouchID 2.2.0:
        <module platform="android" version="2.2.0">ti.touchid</module>
        
  14. Gary Mathews 2017-08-30

    [~Snigdha.Nooli] You can do this for unsupported devices:
        var TouchId = require('ti.touchid');
        
        if (!TouchId.isSupported()) {
            Ti.API.warn('unsupported device!');
            return;
        }
        
        // use TouchId APIs here...
        
  15. Snigdha Nooli 2017-08-31

    Thanks. The issue is resolved with touchid module version 2.2.0.

JSON Source