| | |
| | | |
| | | //6.0以后的如果需要利用本机查找周围的wifi和蓝牙设备, 申请权限 |
| | | if(Build.VERSION.SDK_INT >= 6.0){ |
| | | console.log('Build.VERSION.SDK_INT: ',Build.VERSION.SDK_INT); |
| | | |
| | | } |
| | | let options = this.options |
| | | |
| | | btFindReceiver = plus.android.implements("io.dcloud.android.content.BroadcastReceiver", { |
| | | "onReceive": function(context, intent) { |
| | | plus.android.importClass(context); |
| | | plus.android.importClass(intent); |
| | | let action = intent.getAction(); |
| | | |
| | | console.log(BluetoothDevice) |
| | | |
| | | if(BluetoothDevice.ACTION_FOUND == action) { // 找到设备 |
| | | let device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); |
| | | let newDevice = { |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | let filter = new IntentFilter(); |
| | | filter.addAction(BluetoothDevice.ACTION_FOUND); |
| | | filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); |