Extending FingerprintManager.AuthenticationCallback


I am running into an issue using fingerprint auth if anyone has a moment. Basically, when I try to extend FingerprintManager.AuthenticationCallback to handle the call backs and pass it to the authenticate method on the instance of fingerprintManager, I get an error “Trying to link invalid ‘this’ to a Java object”. I made a small gist with the basic parts of the code


Replied in https://github.com/NativeScript/NativeScript/issues/3450, not sure where we should continue this discussion, but it’s already seen development on github.


I was the one that originally posted on Github and while I have close that issue, I haven’t gotten past the original error.

I have a new Gist here:

There are two issues left, I am sure it is something I am doing wrong but I haven’t gotten past it.

First, in the KeyGenParameterSpec builder I have .setUserAuthenticationRequired(false), which is obviously not correct, this means the key isn’t secured by the fingerprint. However, if I change that to true, the call to init on the cipher fails saying the user is not authenticated, but I don’t think that failure is supposed to happen until you try to encrypt with it because if you try to call fingerprintManager.authenticate( and pass in your crypto object with a cipher that hasn’t been inited, you get an error that the cipher isn’t inited, but the init called failed.

So even if I turn that off, I get the original issue where I cant seem to get extending AuthenticationCallback to work, when I call the above code, I get:

Error: Cannot convert object to Landroid/hardware/fingerprint/FingerprintManager$AuthenticationCallb…

I thought about opening reopening the issue on github, but I am assuming this is an issue with my code and not nativescript, so I am not sure if the preferred location for conversation would be here in the forum or in a github issue.