react-native-roxit-code-scanner 1.0.17 → 1.0.19
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.
|
@@ -2,6 +2,7 @@ package com.roxitcodescanner;
|
|
|
2
2
|
|
|
3
3
|
import android.util.Log;
|
|
4
4
|
import android.content.IntentFilter;
|
|
5
|
+
import android.content.BroadcastReceiver;
|
|
5
6
|
|
|
6
7
|
import com.facebook.react.bridge.Promise;
|
|
7
8
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
@@ -14,10 +15,28 @@ public class RoxitCodeScannerModule extends ReactContextBaseJavaModule {
|
|
|
14
15
|
public RoxitCodeScannerModule(ReactApplicationContext reactContext) {
|
|
15
16
|
super(reactContext);
|
|
16
17
|
this.reactContext = reactContext;
|
|
17
|
-
reactContext.registerReceiver(new ScannerReceiver(),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
reactContext.registerReceiver(new ScannerReceiver(),
|
|
18
|
+
// reactContext.registerReceiver(new ScannerReceiver(),
|
|
19
|
+
// new IntentFilter("com.xcheng.scanner.action.BARCODE_DECODING_BROADCAST")
|
|
20
|
+
// );
|
|
21
|
+
// reactContext.registerReceiver(new ScannerReceiver(),
|
|
22
|
+
// new IntentFilter("android.intent.ACTION_DECODE_DATA")
|
|
23
|
+
// );
|
|
24
|
+
// reactContext.registerReceiver(new ScannerReceiver(),
|
|
25
|
+
// new IntentFilter("scan.rcv.message")
|
|
26
|
+
// );
|
|
27
|
+
// reactContext.registerReceiver(new ScannerReceiver(),
|
|
28
|
+
// new IntentFilter("barcode")
|
|
29
|
+
// );
|
|
30
|
+
reactContext.registerReceiver(new BroadcastReceiver() {
|
|
31
|
+
@Override
|
|
32
|
+
public void onReceive(Context context, Intent intent) {
|
|
33
|
+
if (intent != null) {
|
|
34
|
+
reactContext
|
|
35
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
36
|
+
.emit("barcode", intent.getStringExtra("barcode_string"));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, new IntentFilter("android.intent.ACTION_DECODE_DATA"));
|
|
21
40
|
}
|
|
22
41
|
|
|
23
42
|
@Override
|
|
@@ -6,6 +6,7 @@ import android.util.Log;
|
|
|
6
6
|
import android.os.Bundle;
|
|
7
7
|
import android.widget.Toast;
|
|
8
8
|
|
|
9
|
+
import com.facebook.react.bridge.JavaScriptModule;
|
|
9
10
|
import com.facebook.react.bridge.ReactContext;
|
|
10
11
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
11
12
|
import com.facebook.react.ReactInstanceManager;
|