Mauin / RxFingerprint

Android Fingerprint authentication and encryption with RxJava
Apache License 2.0
379 stars 81 forks source link

Fingerprint operation canceled #108

Open adhikari-jagdish opened 6 years ago

adhikari-jagdish commented 6 years ago

com.mtramin.rxfingerprint.data.FingerprintAuthenticationException: Fingerprint operation canceled. at com.mtramin.rxfingerprint.FingerprintObservable$2.onAuthenticationError(FingerprintObservable.java:89) at android.hardware.fingerprint.FingerprintManager$MyHandler.sendErrorResult(FingerprintManager.java:1188) at android.hardware.fingerprint.FingerprintManager$MyHandler.handleMessage(FingerprintManager.java:1154) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386) D/LoginActivity: Fingerprint operation canceled.

vilaptev commented 6 years ago

com.mtramin.rxfingerprint.data.FingerprintAuthenticationException: Fingerprint operation canceled. at com.mtramin.rxfingerprint.FingerprintObservable$2.onAuthenticationError(FingerprintObservable.java:89) at android.hardware.fingerprint.FingerprintManager$MyHandler.sendErrorResult(FingerprintManager.java:1188) at android.hardware.fingerprint.FingerprintManager$MyHandler.handleMessage(FingerprintManager.java:1154) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386) D/LoginActivity: Fingerprint operation canceled.

@adhikari-jagdish try this approach: Use dispose() each time when you finish your work with fingerprint.

class SomeClass { private var subscription: Disposable? = null fun encrypt(context: Context, fingerKey: String, pin: String) { subscription = RxFingerprint.encrypt(context, fingerKey, pin) .observeOn(AndroidSchedulers.mainThread()) .subscribe({ result: FingerprintEncryptionResult -> //TODO: add code for onNext }, { exception: Throwable -> //TODO: add code for onError }, { //TODO: add code for onComplete }) } fun onFinish() { subscription?.dispose() } }