#if !UNITY_EDITOR && UNITY_ANDROID
#endif
#if !UNITY_EDITOR && UNITY_ANDROID
private static void RequestBluetoothPermission()
{
var sdkVersion = GetAndroidSdkVersion();
if (sdkVersion >= 31)
{
if (!Permission.HasUserAuthorizedPermission("android.permission.BLUETOOTH_CONNECT"))
{
Permission.RequestUserPermission("android.permission.BLUETOOTH_CONNECT");
}
}
}
private static int GetAndroidSdkVersion()
{
using (var version = new AndroidJavaClass("android.os.Build$VERSION"))
{
return version.GetStatic<int>("SDK_INT");
}
}
#endif