1
你可以参考 这个答案. 你可以尝试一些东西喜欢
BluetoothAdapter.getDefaultAdapter()
你可以参考 这个答案. 你可以尝试一些东西喜欢
BluetoothAdapter.getDefaultAdapter()
getDefaultAdapter()
将工作,但他们推荐你迁移到使用和BluetoothManager getAdapter()
.
在一个活动:
val bluetoothManager = getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
m_bluetoothAdapter = bluetoothManager.adapter
在一段:
val bluetoothManager = requireContext().getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
m_bluetoothAdapter = bluetoothManager.adapter
有没有 toast()
功能。 它显然是由 core-ktx
喷气图书馆在同一时间和以后删除。 使用 标准的方式 的表示祝酒词。