Comments (10)
Not really sure what you're asking here.
isCancelled
gets set to false every time the authentication starts.
isCancelled
means the authentication was explicitly cancelled, either by the application itself, or by the system for whatever reason.
It does not indicate whether authentication has already started yes/no.
If you want to check if authentication has started, you can easily keep track of this in your own application state. (for example, by keeping a reference to the promise returned by authenticate()
; if it still exists, clear the reference & cancel authentication)
Hope that helps.
from react-native-fingerprint-android.
Thanks for your answer.
You seems not really understand what I say.
In your codes,there is a line :boolean isCancelled = false;
So If I call isAuthenticationCanceled before start authenticate , it return false , and application will trade it as authenticate is started, but not actually
from react-native-fingerprint-android.
@jariz Is there a reason why you use the boolean isCancelled instead of cancellationSignal.isCanceled()?
from react-native-fingerprint-android.
Thought I would quickly mention that I had to make a small change in order to get cancellation to work consistently. Line 147 of FingerprintModule.java sometimes gets executed, throwing a "this shouldn't happen" AssertionError. This is because promise
is sometimes null when errorCode == FINGERPRINT_ERROR_CANCELED
from react-native-fingerprint-android.
@jariz
[AssertionError. This is because promise is sometimes null when errorCode == FINGERPRINT_ERROR_CANCELED]
Maybe nathan-k said is why I asked you to change isCancelled
variable. When cancel authenticate which is not started actually, 'null' error will happen.(Now initial isCancelled
is false, so application will treat it as authenticate is already running)
from react-native-fingerprint-android.
@WeIio He gave you a good solution to the problem that you were describing.
from react-native-fingerprint-android.
@nathan-k
Thanks.
I had figured out what he said. He had give me a solution that how to judge authentication status by keeping a reference to the promise returned by authenticate() and check it if I need.But I don't think it's a good choice.
In general, In init phase of a class, we always set variables to disabled. For example, there is an OpenFile
class. Set isopen
variable to false in init, When call openFile
function or method, set isopen
to true, that looks make sense.
Additionally, users who take this repository won't need to update or add much more codes to check whether authentication is started
from react-native-fingerprint-android.
@WeIio Ok, I see your point. I don't see the behavior that you describe in the docs for FingerprintManagerCompat, which is probably why it's not in this package:
React Native Fingerprint Android is mostly just a set of bindings to Android FingerprintManager.
Alas, it's very low level.
from react-native-fingerprint-android.
@nathan-k
I honestly can't remember why I'm not using cancellationSignal.isCancelled
.
If you're in the mood to file a PR, I'd gladly accept it. (please test if everything works well with the example app)
@WeIio
Still can't really decipher what you're talking about, but we're gonna get rid of isCancelled completely, so I'm guessing that solves the problem you're having.
from react-native-fingerprint-android.
i find this probleme
Error:(68, 0) Could not read script 'F:\react-native-fingerprint-android-master\example\node_modules\react-native\react.gradle' as it does not exist.
from react-native-fingerprint-android.
Related Issues (18)
- Swap out FingerprintManager for FingerprintManagerCompat. HOT 6
- Auth cancelation HOT 10
- Warning: Activity not started, its current task has been brought to the front
- Fingerprint Template HOT 3
- Eslint Wants an Entrypoint
- java.lang.AssertionError ยท Tried to resolve the auth promise HOT 1
- Change minSdkVersion to 4 HOT 6
- How to determine touch id is turn off, locked without authenticate
- warningCallback not working
- [Question] Any plans to implement Android P Biometrics? HOT 1
- Get the Asymmetric Keys HOT 2
- Whether to support Face ID๏ผ
- In case of error there should be return statement
- Getting requested keys of a value that is not an object HOT 2
- Android M Permissions HOT 3
- Not working when installed along side with mauron85/react-native-background-geolocation
- How to get a token after successful fingerprint authentication, which I can use to identify a particular person? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-fingerprint-android.