1

我已经在我们的 Nexus 7 平板电脑上运行了该应用程序。应用程序在屏幕上列出设备并连接到 BLE 设备。在数据读取部分出现了一些问题。

应用程序连接成功后,我们需要发现设备上的所有服务。discoverServices() 函数在我们的应用程序中不起作用。得到一些异常(android.os.DeadObjectException)。在以下部分中遇到问题

公共无效 onConnectionStateChange(BluetoothGatt gatt,int status,int newState){

        // String intentAction;
        if (newState == BluetoothProfile.STATE_CONNECTED) {


            Log.i("zzz", "Attempting to start service discovery:"
                    + gatt.discoverServices());



        } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {

            Log.i("zzzzz", "Disconnected from GATT server.");
            // broadcastUpdate(intentAction);
        }

    } 
4

0 回答 0