Closed jagan27101986 closed 8 years ago
Clicking on Wrong Fingerprint ; crashes the application
Please provide the error message from logcat.
I don't have the logcat logs as my device system admin has been blocked. Even if i press the wrong finger in the home screen button; the mobile app is crashing
I am using Samsung Galaxy 7 mobile.
public void onAuthenticationFailed() { mAttempts++; int fingerprint_not_recognized_id = mContext.getResources() .getIdentifier("fingerprint_not_recognized", "string", FingerprintAuth.packageName); int fingerprint_too_many_attempts_id = mContext.getResources() .getIdentifier("fingerprint_too_many_attempts", "string", FingerprintAuth.packageName); final String too_many_attempts_string = mIcon.getResources().getString( fingerprint_too_many_attempts_id); if (mAttempts > FingerprintAuth.mMaxAttempts) { showError(too_many_attempts_string); mIcon.postDelayed(new Runnable() { @Override public void run() { mCallback.onError(too_many_attempts_string); } }, ERROR_TIMEOUT_MILLIS); } else { showError(mIcon.getResources().getString( fingerprint_not_recognized_id)); } } The issue is with method as once we give wrong fingerprint ; it crashes the app
I can't be of assistance if I don't know what the error is. I am unable to replicate the error. Please provide a link to a simplified project repo that replicates the error, steps to reproduce the issue and please provide the error message from logcat.
The problem what i found was related to static final long ERROR_TIMEOUT_MILLIS = 1600; Assume that you keep scanning your wrong finger for more than 6 times ; then you will be get a message such as too many attempts and it automatically navigates to Backup option. However Before navigating to Backup Option automatically if you manually click cancel button in the Fingerprint Dialog screen when the error messages is shown as Too Many attempts ,the mobile app crashes.
I was finally able to reproduce the crash and get the logcat error message. As a developer, especially when asking for help, you must to be able to access the logcat.
However, it turns out you were on the right path. But with knowing the exact error it is difficult to diagnose the problem and correct it. Sometimes people ask for help and it has nothing to do with the plugin, but it is their implementation of the plugin.
In this case it was the plugin. When you hit cancel it starts finishing the activity and because of the postDelayed and the ERROR_TIMEOUT_MILLIS the onError was being called after the Fragment had detached from the activity. I added a conditional in the override of onError to check if the Activity exists and the fragment is attached. This will prevent the async call to start the backup activity if cancel has already been clicked.
I have published a fix for this issue as v0.3.1
Below is the logcat of the error for your information.
10-17 09:03:24.162 2370-2370/com.te.meteor.cordova.plugin.android.fingerprintauth I/chromium: [INFO:CONSOLE(36)] "errorCallback(): Cancelled", source: http://meteor.local/app/client/templates/home/home.js?59b46d2b16d5c86fb8c27a237563528d3f3eb152 (36)
10-17 09:03:24.470 2370-2370/com.te.meteor.cordova.plugin.android.fingerprintauth D/AndroidRuntime: Shutting down VM
--------- beginning of crash
10-17 09:03:24.471 2370-2370/com.te.meteor.cordova.plugin.android.fingerprintauth E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.te.meteor.cordova.plugin.android.fingerprintauth, PID: 2370
java.lang.IllegalStateException: Fragment FingerprintAuthenticationDialogFragment{52ac0ae} not attached to Activity
at android.app.Fragment.getResources(Fragment.java:805)
at com.cordova.plugin.android.fingerprintauth.FingerprintAuthenticationDialogFragment.updateStage(FingerprintAuthenticationDialogFragment.java:196)
at com.cordova.plugin.android.fingerprintauth.FingerprintAuthenticationDialogFragment.goToBackup(FingerprintAuthenticationDialogFragment.java:192)
at com.cordova.plugin.android.fingerprintauth.FingerprintAuthenticationDialogFragment.onError(FingerprintAuthenticationDialogFragment.java:266)
at com.cordova.plugin.android.fingerprintauth.FingerprintUiHelper$1.run(FingerprintUiHelper.java:112)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Yes your correct; however in my system i don't have the adb logcat enabled due to administrator right policy issue. In the near future i will try to get access and send the logcat error messages. Thanks for fixing the issue
Hi, The scenario where the application is crashing is such that when we keep on scanning for the wrong fingerprint and after 5 or 6 times and then when i click on cancel ; the app crashes.
Regards