導航:首頁 > 安裝管理 > 安卓獲取已連接的藍牙設備

安卓獲取已連接的藍牙設備

發布時間:2021-07-31 17:20:54

Ⅰ android 怎麼判斷遠程藍牙設備已連接

BluetoothHeadset mBluetoothHeadset;

// Get the default adapter
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

// Establish connection to the proxy.
mBluetoothAdapter.getProfileProxy(context, mProfileListener, BluetoothProfile.HEADSET);

// Define Service Listener of BluetoothProfile
private BluetoothProfile.ServiceListener mProfileListener = new BluetoothProfile.ServiceListener() {
public void onServiceConnected(int profile, BluetoothProfile proxy) {
if (profile == BluetoothProfile.HEADSET) {
mBluetoothHeadset = (BluetoothHeadset) proxy;
}
}
public void onServiceDisconnected(int profile) {
if (profile == BluetoothProfile.HEADSET) {
mBluetoothHeadset = null;
}
}
};

//call functions on mBluetoothHeadset to check if Bluetooth SCO audio is connected.
List<BluetoothDevice> devices = mBluetoothHeadset.getConnectedDevices();
for ( final BluetoothDevice dev : devices ) {
return mBluetoothHeadset.isAudioConnected(dev);
}

// finally Close proxy connection after use.
mBluetoothAdapter.closeProfileProxy(mBluetoothHeadset);

Ⅱ android 獲取的藍牙設備信息嗎

Android對於藍牙開發從2.0版本的sdk才開始支持,而且模擬器不支持,測試至少需要兩部手機,內所以制容約了很多技術人員的開發。
android藍牙開發 藍牙設備的查找和連接
http://blog.csdn.net/centralperk/article/details/8080908

Ⅲ android 怎麼查看藍牙設備

安卓系統的平板電腦,在設置裡面可以查看到藍牙地址。手機查詢藍牙地址的話,專在撥號鍵盤上鍵屬入:*#2820#
查詢
藍牙
mac
地址。現在也可來查一下啦~步驟如下:
(1)在主屏幕上輕按「設置」按鈕。或者,按下物理按鈕「menu」,選擇「設置」。
(2)在設置的列表下,輕按選擇「關於本機」按鈕。
(3)然後,輕按「狀態消息」按鈕。
(4)查看「藍牙地址」注意:
必須開啟藍牙,才能查看到藍牙地址。編者按:
安卓系統平板電腦中藍牙地址,對於普通用戶,很少能用得著。藍牙地址可以說是連接到設備的唯一通
道,通過識別協議,可實現設備間的數據傳輸。一般,我們用不著,但如果有人問你查詢「藍牙地址」,你就可以告訴他。

Ⅳ 這段 安卓軟體中的代碼中如何判斷 手機是否連接到 藍牙設備

安卓藍牙中抄。要連接其他設備要調用襲connect()函數。。此函數你可以去看一下,官方說的是:若連接成功,就不會產生異常。不成功,就會產生異常。。。所以看看程序會運行異常不。運行了,說明沒有連接成功。沒運行,則連接成功了。
try {
// 連接
connect(device);
} catch (IOException e) {
Toast.makeText(MainActivity.this, "沒有成功連接設備", //1
Toast.LENGTH_SHORT).show();
}

若成功了,不會運行1,不成功,就會產生異常。運行異常中的程序,也就是代碼1.

Ⅳ 通過android代碼如何實現手機藍牙自動連接最後一次已配對的設備

先明確場景。你是希望如下哪種自動連接?

case1: 手機開機自動連接藍牙最後配對設備:Android已經在Framework層實現。不需要Apk再做。關鍵代碼如下:

.java 裡面

onReceive 收到事件BluetoothAdapter.STATE_ON後

else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {

initiateConnection();給狀態機發CONNECT

.sendMessage(.CONNECT);


case2:藍牙關閉狀態,打開藍牙,自動連接最後使用的設備:Apk層注冊監聽藍牙打開的廣播,然後在事件響應中獲取已配對列表,取第一個去進行連接就好。

  1. 注冊監聽藍牙打開的廣播事件:android.bluetooth.adapter.action.STATE_CHANGED

    Bluetooth ACTION_STATE_CHANGED curState = 11,preState = 10 打開中

    Bluetooth ACTION_STATE_CHANGED curState = 12,preState = 11 打開了。

  2. 獲取已配對設備列表:BluetoothAdapter.getBondedDevices()

  3. 取出第一個設備(也就是最新的),連接:

    framework/base/core/java/android/bluetooth/

    BluetoothHeadsetClient: connect(device)

    BluetoothA2dpSink: connect(device)

Ⅵ 安卓手機如何快速刪除已連接的藍牙設備

手機藍牙目前還沒有能一鍵刪除已連接的藍牙設備記錄的功能,只能一個一個【取內消配對】。


手機桌面,向容下拉選擇快捷藍牙。或者在手機設置中找到藍牙並打開。


【藍牙】

藍牙(Bluetooth®):是一種無線技術標准,可實現固定設備、移動設備和樓宇個人域網之間的短距離數據交換(使用2.4—2.485GHz的ISM波段的UHF無線電波)。

Ⅶ android如何獲得已配對設備的藍牙mac地址

//獲取已經保存過的設備信息內
Set<BluetoothDevice> devices = mBluetoothAdapter.getBondedDevices();
if (devices.size()>0) {
for(Iterator<BluetoothDevice> iterator=devices.iterator();iterator.hasNext();){
BluetoothDevice bluetoothDevice=(BluetoothDevice)iterator.next();
System.out.println("設備:容"+bluetoothDevice.getName() + " " + bluetoothDevice.getAddress());
}
}

Ⅷ 安卓手機如何快速刪除已連接的藍牙設備

手機藍牙目前還沒有能一鍵刪除已連接的藍牙設備記錄的功能,只能一個一個【取消配對】。

Ⅸ android下如何查看已連接的藍牙設備

;

//Getthedefaultadapter
=BluetoothAdapter.getDefaultAdapter();

//Establishconnectiontotheproxy.
mBluetoothAdapter.getProfileProxy(context,mProfileListener,BluetoothProfile.HEADSET);


//
privateBluetoothProfile.=newBluetoothProfile.ServiceListener(){
publicvoidonServiceConnected(intprofile,BluetoothProfileproxy){
if(profile==BluetoothProfile.HEADSET){
mBluetoothHeadset=(BluetoothHeadset)proxy;
}
}
(intprofile){
if(profile==BluetoothProfile.HEADSET){
mBluetoothHeadset=null;
}
}
};


//.
List<BluetoothDevice>devices=mBluetoothHeadset.getConnectedDevices();
for(finalBluetoothDevicedev:devices){
returnmBluetoothHeadset.isAudioConnected(dev);
}


//.
mBluetoothAdapter.closeProfileProxy(mBluetoothHeadset);

Ⅹ 如何查看安卓手機中已配對藍牙設備信息

在手機中找到設置---點開-----一般會在WLAN 下面----藍牙----打開 可以看到各種藍牙已應用的信息

閱讀全文

與安卓獲取已連接的藍牙設備相關的資料

熱點內容
黑龍江特種設備檢驗研究院 瀏覽:210
機械化養護中心 瀏覽:838
上海特種設備管理 瀏覽:48
機械師改槍 瀏覽:181
機械化剪紙 瀏覽:757
美燃環保設備 瀏覽:809
濟南北斗星數控設備有限公司 瀏覽:838
自動噴塗機械手 瀏覽:457
中小型農業機械加工項目建議書 瀏覽:251
不銹鋼加工設備市轉讓 瀏覽:441
水稻生產全程機械化 瀏覽:110
扳手機械原理 瀏覽:61
凱格精密機械有限公司 瀏覽:61
廣毅機電設備 瀏覽:805
重慶三陽辦公設備有限公司 瀏覽:494
華技達自動化設備 瀏覽:631
東莞石碣自動化設備廠 瀏覽:131
機械制圖陳列櫃 瀏覽:246
鄭州奧鑫游樂設備公司 瀏覽:733
美邦環保設備有限公司 瀏覽:386