Android имя Bluetooth не работает для некоторых устройств - PullRequest
0 голосов
/ 30 апреля 2020

Установить имя Bluetooth

final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

if (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) {
    Boolean isChanged = mBluetoothAdapter.setName(AppSystem.getInstance(getApplicationContext()).getUserNumber());
    System.out.println("BluetoothNameChanged: " + "" + isChanged);
}

На другом конце, когда устройство обнаружило Bluetooth, оно показывает неправильное имя

if (BluetoothDevice.ACTION_FOUND.equals(action)) {
                // Discovery has found a device. Get the BluetoothDevice
                // object and its info from the Intent.
                BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                String deviceName = device.getName();
                System.out.println("BluetoothNameNearBy: " + deviceName); 
    }

Я тестирую с Samsung J7 Max и Redmi Note 5 Pro. В устройстве Samsung я получаю обновленное имя, когда ACTION_FOUND, но в Redmi я не получаю.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...