新增 蓝牙扫描库

master
wenfei 3 months ago
parent 6858197a03
commit 31c0e31846

@ -5,7 +5,8 @@
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="true" /> <!-- Android 12 中的新蓝牙权限开始 -->
android:required="true" />
<!-- Android 12 中的新蓝牙权限开始 -->
<!-- Request legacy Bluetooth permissions on older devices. -->
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"

@ -121,7 +121,7 @@ public class BlueToothDeviceActivity extends BaseActivity {
}
showLog("扫描发现设备" + device.getName() + "," + device.getAddress());
String deviceName = device.getName();
if (deviceName != null && !deviceName.isEmpty()){
if (deviceName != null && !deviceName.isEmpty()&&deviceName.startsWith("W3")){
//showLog(new Gson().toJson(device));
mLeDeviceListAdapter.addDevice(device);
mLeDeviceListAdapter.notifyDataSetChanged();

Loading…
Cancel
Save