#14: WIP we now show the new GUI properly

This commit is contained in:
geeksville 2020-04-18 16:30:30 -07:00
parent 840dbd491e
commit b4bf682df0
6 changed files with 177 additions and 19 deletions

View file

@ -6,6 +6,8 @@ import android.bluetooth.BluetoothGattCharacteristic
import android.bluetooth.BluetoothManager
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.os.IBinder
import android.os.RemoteException
import androidx.core.content.edit
@ -197,6 +199,18 @@ class RadioInterfaceService : Service(), Logging {
MeshService.startService(context)
}
}
/// Can we use the modern BLE scan API?
fun hasCompanionDeviceApi(context: Context): Boolean =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val res =
context.packageManager.hasSystemFeature(PackageManager.FEATURE_COMPANION_DEVICE_SETUP)
debug("CompanionDevice API available=$res")
res
} else {
warn("CompanionDevice API not available, falling back to classic scan")
false
}
}