Add GLS feature

This commit is contained in:
Sylwester Zieliński
2021-09-30 13:37:45 +02:00
parent 7a171a1402
commit b2da2f20eb
37 changed files with 1036 additions and 102 deletions

View File

@@ -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>

View File

@@ -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