mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-19 07:24:22 +01:00
Add GLS feature
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
package="no.nordicsemi.android.service">
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
|
||||
</manifest>
|
||||
@@ -16,6 +16,15 @@ class SelectedBluetoothDeviceHolder constructor(
|
||||
return deviceManager.associations.firstOrNull()?.let { bluetoothAdapter?.getRemoteDevice(it) }
|
||||
}
|
||||
|
||||
//TODO: Check if starts automatically
|
||||
fun bondDevice() {
|
||||
device?.let {
|
||||
if (it.bondState == BluetoothDevice.BOND_NONE) {
|
||||
it.createBond()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun forgetDevice() {
|
||||
device?.let {
|
||||
val deviceManager = context.getSystemService(Context.COMPANION_DEVICE_SERVICE) as CompanionDeviceManager
|
||||
|
||||
Reference in New Issue
Block a user