android 9 让蓝牙开启 即可被发现

您所在的位置:网站首页 蓝牙设置不可见 android 9 让蓝牙开启 即可被发现

android 9 让蓝牙开启 即可被发现

2024-07-13 23:47| 来源: 网络整理| 查看: 265

默认打开蓝牙开关 蓝牙是不可以被其他设备发现的

只能在蓝牙界面才可以被发现

如果想打开开关就被发现

需修改代码

btservice/AdapterProperties.java

 void onBluetoothReady() {         debugLog("onBluetoothReady, state=" + BluetoothAdapter.nameForState(getState())                 + ", ScanMode=" + mScanMode);

        synchronized (mObject) {             // Reset adapter and profile connection states             setConnectionState(BluetoothAdapter.STATE_DISCONNECTED);             mProfileConnectionState.clear();             mProfilesConnected = 0;             mProfilesConnecting = 0;             mProfilesDisconnecting = 0;             // adapterPropertyChangedCallback has already been received.  Set the scan mode.             //setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE);

            //可以连接 不能被发现             setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);

            //可以连接 也可以被发现                          // This keeps NV up-to date on first-boot after flash.             setDiscoverableTimeout(mDiscoverableTimeout);         }     }



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3