我想用蓝牙将我的应用程序连接到服务器。 但我不知道这个uuid是什么,我应该怎么找到它?
class ConnectThread extends Thread {
private final BluetoothSocket mmSocket;
private final BluetoothDevice mmDevice;
// Get a BluetoothSocket to connect with the given BluetoothDevice
try {
// MY_UUID is the app's UUID string, also used by the server code
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
///这给了我一个错误,我怎么回答它?
答案 0 :(得分:1)
如果您使用的是BluetoothChat源代码,请在文件BluetoothChatService.java中找到UUID,如下所示:
public class BluetoothChatService {
.
.
// Unique UUID for this application
private static final UUID MY_UUID_SECURE =
UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");
private static final UUID MY_UUID_INSECURE =
UUID.fromString("8ce255c0-200a-11e0-ac64-0800200c9a66");
.
.