diff --git a/android/src/main/java/com/dj/pda/scaner/dj_scaner/DjScanerPlugin.java b/android/src/main/java/com/dj/pda/scaner/dj_scaner/DjScanerPlugin.java index bf64a3d..50d1073 100644 --- a/android/src/main/java/com/dj/pda/scaner/dj_scaner/DjScanerPlugin.java +++ b/android/src/main/java/com/dj/pda/scaner/dj_scaner/DjScanerPlugin.java @@ -47,13 +47,12 @@ public class DjScanerPlugin implements FlutterPlugin, MethodCallHandler { } }; } - ; private BroadcastReceiver scanReceiver; @Override public void onListen(Object arguments, EventChannel.EventSink events) { - System.out.println("注册广播"); + System.out.println("开始监听扫描"); scanReceiver = createScanReceiver(events); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(SCANACTION); @@ -63,7 +62,7 @@ public class DjScanerPlugin implements FlutterPlugin, MethodCallHandler { @Override public void onCancel(Object arguments) { - System.out.println("注销广播"); + System.out.println("结束监听扫描"); context.unregisterReceiver(scanReceiver); } }); @@ -109,8 +108,7 @@ public class DjScanerPlugin implements FlutterPlugin, MethodCallHandler { call.method.equals("scanEnabled") ) { boolean arg=(boolean) call.argument("onOpen"); - System.out.println("扫描开关:"); - System.out.println(arg); + System.out.println("扫描开关:"+(arg?"开启":"关闭")); Intent intent = new Intent("com.android.scanner.ENABLED"); intent.putExtra("enabled",arg); context.sendBroadcast(intent); diff --git a/lib/dj_scaner.dart b/lib/dj_scaner.dart index 09b3655..0cc83d7 100644 --- a/lib/dj_scaner.dart +++ b/lib/dj_scaner.dart @@ -29,7 +29,6 @@ class DjScaner { } static Future init() async { - print('初始化'); ///默认关闭声音 await soundPlay(false); @@ -45,7 +44,7 @@ class DjScaner { ///默认关闭扫描 await scanEnabled(false); - print('初始化完成'); + print('扫描初始化完成'); } ///声音开关