在使用BluetoothGatt发现服务时,需要注意以下几点:
bluetoothGatt.discoverServices();
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
if (status == BluetoothGatt.GATT_SUCCESS) {
List
// 如果已经发现过服务,重新发现服务 if (gattServices != null) { gatt.discoverServices(); }
在重新发现服务之后,再次在onServicesDiscovered()回调方法中获取服务列表。
综上所述,可以在BluetoothGatt中使用discoverServices()方法来重新发现服务,以更新服务列表。