Inhand blutooth_client.discoverdevices()报告&quot" nullReferenceException:' object reference未设置为对象的实例。
我试图使用inthand.net.bluetooth编写服务器代码和客户端代码,以促进Android手表和Windows之间的通信。但是,该行“ client.discoverdevices();”继续记录以下错误。任何人都可以看看并提供一些帮助吗?如果有人能提供任何帮助,真的很感激。
错误消息是:
system.nullReferenceException:“对象引用未设置为对象的实例。”
发生在线上:
Bluetooth client = new BluetoothClient();
for each (var item in client.DiscoverDevices()) {
......
}
使用32feet.net软件包运行PC-PC通信程序时不会发生这样的问题。
I attempted to write the Server code and Client code using inTheHand.Net.Bluetooth to promote communication between android watch and Windows. However, the line "client.DiscoverDevices();" keeps recording the following error. Is it possible for anybody to have a look and give some help? Really appreciate it if anyone can help by any amount.
The error message is:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
Occured at the line:
Bluetooth client = new BluetoothClient();
for each (var item in client.DiscoverDevices()) {
......
}
Such a problem will not occur when running PC-PC communication program using 32Feet.net package.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查此 link> link in Android com in android。
当应用程序加载时,请勿调用“
new BluetoothClient()
”。当您执行此操作时
加载应用程序后,尝试调用“
new Blueotoothclient()
”。Check this link for any permission on android.
Do not call "
new BluetoothClient()
" when the application is loading.when you do this any subsequent call will fail on
BluetoothRadio.GetDefault
Try to call "
new BlueotoothClient()
" after application was loaded.在初始化Android上的
bluetoothclient()
之前,您可能需要添加下面的行。在
在使用库之前。
you may need to add the line below before you initialise the
BluetoothClient()
on Android.Note:
this.Activity
may be fine as just 'this'I had the same issue and eventualy discovered that you need to set the running activity before using the library.