Nie ma oficjalnego API, aby pobrać nazwę noszenia urządzenia, które jest wyświetlane, gdy zegarek jest pierwszym uruchomieniu, takich jak G zegarek 1234 lub 1234. Moto 360
To może się zmienić w przyszłości, ale jeśli chcesz uzyskać podobną nazwę teraz, musisz zrobić coś takiego:
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
String btAddress = "No Bluetooth";
if (btAdapter != null)
btAddress = btAdapter.getAddress();
// Reconstitute the pairing device name from the model and the last 4 digits of the bluetooth MAC
String wearName;
if ((btAddress != null) && (!btAddress.equals("No Bluetooth"))) {
wearName = android.os.Build.MODEL;
String[] tokens = btAddress.split(":");
wearName += " " + tokens[4] + tokens[5];
wearName = wearName.toUpperCase();
} else {
wearName = "No Bluetooth";
}
Podekscytowany, aby wiedzieć, jaki będzie wynik? jeśli korzystamy z aplikacji Android Wear Preview! –