我用android4.0自带的HDP demo连接欧姆龙血压计,只能在第一次运行接收数据,退出程序,重新打开,接收数据报错,错误信息:E/InputQueue-JNI(4476): channel '41304a38 com.example.bluetooth.health/com.example.bluetooth.health.BluetoothHDPActivity (client)' ~ Publisher closed input channel or an error occurred. events=0x8。
为什么?
首先,要看一下bluetoothHDP的说明文档:
1 /* 2 A sample application that demonstrates how to communicate with a Bluetooth Health Device Profile (HDP) device. This feature is available on Android 4.0 (API level 14) or above platforms. 3 4 The application manages connection with Bluetooth HDP-enabled devices. Possible device type include blood pressure monitor, glucose meter, thermometer, etc. Upon connection, the application retrieves raw data sent from the device. Note that in order to interpret the data, a parser that conforms to the IEEE 11073-xxxxx specifications would be required. 5 */
This feature is available on Android 4.0 (API level 14) or above platforms。这个很重要。
下面是连接成功的界面,
还有一点在AndroidManifest.xml中有没配置这个...
1 <uses-sdk android:minSdkVersion="14" 2 android:targetSdkVersion="14" /> 3 <uses-permission android:name="android.permission.BLUETOOTH" />
如果上面都没错的话,试试重新启动设备再试一下....
希望大家多多交流:hongtenzone@foxmail.com
我的android设备是4.0.3的,第一次可以接收数据,退出程序,重新打开报错,然后设备自动重启了
@zhujinhu: 还有一种方法,就是把安装的那个应用程序,卸载了,重新安装试试
@Hongten: 这个方法也试过了,不行。
@zhujinhu: 对不起,最近会了一次家乡,没来得及查看博客园信息,不知道你的问题有没得到解决,如果有可以分享一下吗?
@Hongten: 没解决,好像是系统底层的问题。