日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

xamarin.android蓝牙,在Android上连接Xamarin的配对蓝牙设备

發(fā)布時間:2025/3/21 60 豆豆
生活随笔 收集整理的這篇文章主要介紹了 xamarin.android蓝牙,在Android上连接Xamarin的配对蓝牙设备 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

請記住,Xamarin綁定到本機(jī)api所以不要擔(dān)心某些“與本機(jī)方式有關(guān)”;)基于你引用的anwser我編寫并測試了下面的代碼 . 我希望它會對你有所幫助 .

class btListener : Java.Lang.Object, IBluetoothProfileServiceListener

{

public void OnServiceConnected([GeneratedEnum] ProfileType profile, IBluetoothProfile proxy)

{

String deviceName = "JABRA WAVE+";

BluetoothDevice result = null;

var devices = BluetoothAdapter.DefaultAdapter.BondedDevices;

if (devices != null)

{

foreach (BluetoothDevice device in devices)

{

if (deviceName == device.Name)

{

result = device;

break;

}

}

}

var connect = Java.Lang.Class.FromType(typeof(BluetoothA2dp)).GetDeclaredMethod("connect", Java.Lang.Class.FromType(typeof(BluetoothDevice)));

connect.Invoke((Java.Lang.Object)proxy, result);

}

public void OnServiceDisconnected([GeneratedEnum] ProfileType profile)

{

}

}

以下代碼如下OnCreate功能:

btListener btReceiver = new btListener();

BluetoothAdapter.DefaultAdapter.GetProfileProxy(this, btReceiver, ProfileType.A2dp);

只是看了一下日期..但我還是張貼了答案 - 也許它仍然會幫助某人

總結(jié)

以上是生活随笔為你收集整理的xamarin.android蓝牙,在Android上连接Xamarin的配对蓝牙设备的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。