【问题标题】:Check if bluetooth is active on Android?检查蓝牙是否在 Android 上处于活动状态?
【发布时间】:2022-01-01 21:16:15
【问题描述】:

是否有以编程方式检查 Android 设备上蓝牙是否处于活动状态

要知道位置是否启用,如下所示:

if (!Input.location.isEnabledByUser)
{
    //Location not active!
    return;
}

【问题讨论】:

    标签: c# android unity3d bluetooth bluetooth-lowenergy


    【解决方案1】:

    我猜你可以只检查适配器状态:

    public void EnableIfNeeded(BluetoothAdapter adapter)
     {
         if (!adapter.IsEnabled)
         {
             adapter.Enable();
         }
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-11
      • 2019-12-10
      • 1970-01-01
      • 1970-01-01
      • 2011-11-22
      • 2013-04-06
      • 1970-01-01
      相关资源
      最近更新 更多