适配新PDA(k62v1_6c)扫描头与摄像头冲突

This commit is contained in:
梁越超 2022-12-27 14:47:09 +08:00
parent fda5173954
commit 018b7548f4
3 changed files with 5 additions and 16 deletions

View File

@ -3,7 +3,7 @@
## 安装方法 ## 安装方法
`cordova plugin add git+http://m.shuto.cn:8680/center/redlightscan-cordova-plugin.git` `cordova plugin add git+https://m.shuto.cn:8681/center/redlightscan-cordova-plugin.git`
## 调用方法 ## 调用方法

View File

@ -10,7 +10,7 @@
<config-file parent="/*" target="res/xml/config.xml"> <config-file parent="/*" target="res/xml/config.xml">
<feature name="RedLightScan"> <feature name="RedLightScan">
<param name="android-package" value="cn.shuto.plugin.redlightscan.RedLightScan" /> <param name="android-package" value="cn.shuto.plugin.redlightscan.RedLightScan" />
<param name="onload" value="true" /> <param name="onload" value="false" />
</feature> </feature>
</config-file> </config-file>
<config-file parent="/*" target="AndroidManifest.xml"> <config-file parent="/*" target="AndroidManifest.xml">

View File

@ -86,6 +86,7 @@ public class RedLightScan extends CordovaPlugin {
} }
private void registerReceiver() { private void registerReceiver() {
Log.d(TAG, "RedLightScan registerReceiver");
if (scanUtil == null) { if (scanUtil == null) {
scanUtil = new ScanUtil(cordova.getActivity()); scanUtil = new ScanUtil(cordova.getActivity());
//we must set mode to 0 : BroadcastReceiver mode //we must set mode to 0 : BroadcastReceiver mode
@ -95,10 +96,12 @@ public class RedLightScan extends CordovaPlugin {
filter.addAction("com.rfid.SCAN"); filter.addAction("com.rfid.SCAN");
webView.getContext().registerReceiver(receiver, filter); webView.getContext().registerReceiver(receiver, filter);
this.receiverRegisted = true; this.receiverRegisted = true;
this.startScan();
Log.d(TAG, "RedLightScan receiver registed"); Log.d(TAG, "RedLightScan receiver registed");
} }
private void unregisterReceiver() { private void unregisterReceiver() {
Log.d(TAG, "RedLightScan unregisterReceiver");
if (scanUtil != null) { if (scanUtil != null) {
scanUtil.setScanMode(1); scanUtil.setScanMode(1);
scanUtil.close(); scanUtil.close();
@ -111,20 +114,6 @@ public class RedLightScan extends CordovaPlugin {
} }
} }
@Override
public void onResume(boolean multitasking) {
super.onResume(multitasking);
Log.d(TAG, "RedLightScan Resume");
this.registerReceiver();
}
@Override
public void onPause(boolean multitasking) {
super.onPause(multitasking);
Log.d(TAG, "RedLightScan Pause");
this.unregisterReceiver();
}
@Override @Override
public void onDestroy() { public void onDestroy() {
Log.d(TAG, "RedLightScan Destroy"); Log.d(TAG, "RedLightScan Destroy");