Cannot convert Javascript Object

plugins

#1

I’m trying to integrate a third party finger print scanner (IB Scan) for Android with my NativeScript app.

I’m getting an error Cannot convert object to com.integratedbiometrics.ibscanultimate.IBScanListener at this line - https://github.com/manojdcoder/nativescript-ib-scan/blob/831674bf221cb72b9e1bf812f7b16eae5daf7b8a/src/ib-scan.android.ts#L89

I have also uploaded the working sample of native android project here - https://github.com/manojdcoder/sample-ib-scan

Does anyone has clue how to fix this?


#2

@manojdcoder
why not use
https://www.npmjs.com/package/nativescript-fingerprint-auth

It supports both Android and iOS.


#3

@multishiv19 Thanks for the suggestion, but as I already mentioned I’m trying to integrate a third party scanner, not for the purpose of authentication but for recording user’s fingerprints.


#4

@manojdcoder
In your code, the IbScan class extends from Common class, which extends from Observable.
That’s why it cannot be converted to type com.integratedbiometrics.ibscanultimate.IBScanListener.

To implement listeners you can do something like this

As in, create a new Listener of type com.integratedbiometrics.ibscanultimate.IBScanListener and write the methods that are a part of it, inside it. (similar to the way I’m writing onDateSet, in my code)


#5

@multishiv19 Thanks, You were right. Now I’m extending from java.lang.Object and additionally I had to use globals.__native(this) as mention here.


#6

@manojdcoder Awesome! Happy that it worked for you :slight_smile: