我想测试我的
Android设备是否可以发现之前发送提示用户打开它的意图,我该怎么办?
意图如下:
Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); intent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION,30); startActivityForResult(intent,idBlueToothDiscoveryRequest);
解决方法
我发现:
if(mBluetoothAdapter.getScanMode() != BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) { Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); intent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION,30); startActivityForResult(intent,idBlueToothDiscoveryRequest); }