react-native-rdservice-fingerprintscanner 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/android/src/main/java/com/reactnativerdservicefingerprintscanner/RDServiceManager.java +1 -3
- package/android/src/main/java/com/reactnativerdservicefingerprintscanner/RdserviceFingerprintscannerModule.java +2 -6
- package/package.json +1 -1
- package/src/index.d.ts +2 -1
- package/src/index.js +1 -2
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ allprojects {
|
|
|
31
31
|
## Usage
|
|
32
32
|
|
|
33
33
|
```js
|
|
34
|
-
import { getDeviceInfo, captureFinger } from "react-native-rdservice-fingerprintscanner";
|
|
34
|
+
import { getDeviceInfo, captureFinger,DEFAULT_PID_OPTIONS } from "react-native-rdservice-fingerprintscanner";
|
|
35
35
|
|
|
36
36
|
// ...
|
|
37
37
|
|
|
@@ -43,7 +43,7 @@ getDeviceInfo()
|
|
|
43
43
|
console.log(error, 'DEVICE DRIVER NOT FOUND'); //Failed to get device information
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
captureFinger(pidOptions)
|
|
46
|
+
captureFinger(pidOptions) //you can pass pidOptions (optional) to "captureFinger(pidOptions)"" method otherwise it takes DEFAULT_PID_OPTIONS
|
|
47
47
|
.then((response) => {
|
|
48
48
|
console.log(response, 'FINGER CAPTURE'); // FingerPrint Response
|
|
49
49
|
})
|
|
@@ -55,6 +55,8 @@ getDeviceInfo()
|
|
|
55
55
|
|
|
56
56
|
```pidOptions``` is an XML String that you have to pass to ```captureFinger``` method. Refer [UIDAI Document](https://uidai.gov.in/images/resource/Aadhaar_Registered_Devices_2_0_4.pdf)
|
|
57
57
|
|
|
58
|
+
```DEFAULT_PID_OPTIONS``` is used when you not passed the pidOptions to the ```captureFinger()``` Method.
|
|
59
|
+
|
|
58
60
|
```Note``` : Call ```captureFinger()``` Method after getting response from getDeviceInfo() method. Calling of ```captureFinger()``` method before ```getDeviceInfo()``` method, only returns Error in ```catch``` block. Refer [Example Code](https://github.com/senthalan2/react-native-rdservice-fingerprintscanner/blob/main/example/src/App.js)
|
|
59
61
|
|
|
60
62
|
|
|
@@ -85,6 +87,13 @@ pidDataXML | XML DATA | pidData Captured Fingerprint
|
|
|
85
87
|
rdServicePackage | Device Package
|
|
86
88
|
message | Message about Success or Failure
|
|
87
89
|
|
|
90
|
+
## Tested Devices
|
|
91
|
+
|
|
92
|
+
Device Name | Result
|
|
93
|
+
--- | ---
|
|
94
|
+
STARTEK | :white_check_mark:
|
|
95
|
+
MORPHO | :white_check_mark:
|
|
96
|
+
MANTRA | :white_check_mark:
|
|
88
97
|
|
|
89
98
|
## Contributing
|
|
90
99
|
|
package/android/src/main/java/com/reactnativerdservicefingerprintscanner/RDServiceManager.java
CHANGED
|
@@ -6,7 +6,6 @@ import android.content.Intent;
|
|
|
6
6
|
import android.content.pm.ResolveInfo;
|
|
7
7
|
import android.os.Bundle;
|
|
8
8
|
import android.util.Log;
|
|
9
|
-
import android.widget.Toast;
|
|
10
9
|
|
|
11
10
|
import androidx.annotation.NonNull;
|
|
12
11
|
|
|
@@ -201,7 +200,7 @@ public class RDServiceManager {
|
|
|
201
200
|
if (mapRDDriverRCIndex.containsKey(rd_service_package)) {
|
|
202
201
|
int capture_rc_index = mapRDDriverRCIndex.get(rd_service_package);
|
|
203
202
|
int capture_rc = getRDServiceCaptureRC(capture_rc_index);
|
|
204
|
-
|
|
203
|
+
|
|
205
204
|
Log.d(TAG, "RDSERVICE BEFORE CAPTURE: pid_options: (" + capture_rc_index + ") " + capture_rc + " ~ " + pid_options);
|
|
206
205
|
|
|
207
206
|
// Capture fingerprint using RD Service
|
|
@@ -211,7 +210,6 @@ public class RDServiceManager {
|
|
|
211
210
|
activity.startActivityForResult(intentCapture, capture_rc);
|
|
212
211
|
} else {
|
|
213
212
|
mRDEvent.onRDServiceDriverDiscoveryFailed(0, null, rd_service_package, "Package not found or not whitelisted");
|
|
214
|
-
Toast.makeText(activity, "RDSERVICE CAPTURE ERROR", Toast.LENGTH_SHORT).show();
|
|
215
213
|
Log.d(TAG, "RDSERVICE CAPTURE ERROR: package not found or not whitelisted: " + rd_service_package);
|
|
216
214
|
}
|
|
217
215
|
}
|
|
@@ -97,14 +97,13 @@ public class RdserviceFingerprintscannerModule extends ReactContextBaseJavaModul
|
|
|
97
97
|
JSONObject response = obj.getJSONObject("PidData").getJSONObject("Resp");
|
|
98
98
|
String errorCode = response.getString("errCode");
|
|
99
99
|
String errInfo = "";
|
|
100
|
-
|
|
101
100
|
WritableMap responseData = Arguments.createMap();
|
|
102
101
|
if(Integer.parseInt(errorCode) == 0 ){
|
|
103
102
|
responseData.putInt("status",1);
|
|
104
103
|
responseData.putString("message","FingerPrint Scanned Successfully");
|
|
105
104
|
}
|
|
106
105
|
else {
|
|
107
|
-
|
|
106
|
+
errInfo = response.getString("errInfo");
|
|
108
107
|
responseData.putInt("status",0);
|
|
109
108
|
responseData.putString("message","Make Sure the Device is Connected and OTG Connection is Enabled in your Mobile");
|
|
110
109
|
}
|
|
@@ -117,11 +116,8 @@ public class RdserviceFingerprintscannerModule extends ReactContextBaseJavaModul
|
|
|
117
116
|
promise.resolve(responseData);
|
|
118
117
|
}
|
|
119
118
|
catch (JSONException e){
|
|
120
|
-
|
|
121
|
-
promise.reject("FINGERPRINT_CAPTURE__FAILED",e.getMessage());
|
|
119
|
+
promise.reject("FINGERPRINT_CAPTURE__FAILED","FingerPrint Capture Failed");
|
|
122
120
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
121
|
}
|
|
126
122
|
|
|
127
123
|
@Override
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ declare module "react-native-rdservice-fingerprintscanner" {
|
|
|
22
22
|
errorCode: number,
|
|
23
23
|
message: string,
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
export const DEFAULT_PID_OPTIONS :string;
|
|
26
27
|
export function getDeviceInfo(): Promise<deviceInfoProps | optionalInfo>;
|
|
27
28
|
export function captureFinger(pidOptions: string):Promise<fingerprintDataProps>;
|
|
28
29
|
|
package/src/index.js
CHANGED
|
@@ -16,7 +16,6 @@ const RdserviceFingerprintscanner = NativeModules.RdserviceFingerprintscanner
|
|
|
16
16
|
},
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
|
-
|
|
20
19
|
export const DEFAULT_PID_OPTIONS = `<PidOptions ver="1.0"> <Opts fCount="1" fType="0" iCount="0" pCount="0" format="0" pidVer="2.0" timeout="20000" otp="" posh="UNKNOWN" env="P" wadh="" /> <Demo></Demo><CustOpts> <Param name="ValidationKey" value="" /> </CustOpts> </PidOptions>`;
|
|
21
20
|
|
|
22
21
|
export function getDeviceInfo() {
|
|
@@ -47,7 +46,7 @@ export function getDeviceInfo() {
|
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
export function captureFinger(pidOptions) {
|
|
49
|
+
export function captureFinger(pidOptions = DEFAULT_PID_OPTIONS) {
|
|
51
50
|
return new Promise((resolve, reject) => {
|
|
52
51
|
RdserviceFingerprintscanner.captureFinger(pidOptions)
|
|
53
52
|
.then((res) => {
|