我正在编写我的第一个Android应用程序,但没有成功-我在蓝牙GATT的读写可靠性方面遇到了很大的问题。30分钟前,我能够从手机向外围设备写入一个字节,并看到它已收到。我现在不可以。我开始认为这种间歇性错误是导致问题的原因:java.lang.NullPointerException:Attempttoinvokevirtualmethod'voidandroid.content.Context.sendBroadcast(android.content.Intent)'onanullobjectreferenceatandroid.content.ContextWrapper.se
我正在关注用于在Android4.3中开发低功耗蓝牙的低功耗蓝牙页面我尝试通过以下代码连接BLE设备:publicvoidconnect(finalStringaddress){//TODOAuto-generatedmethodstubLog.w(TAG,"BluetoothLeServiceConnectfunction.");if(mBluetoothAdapter==null||address==null){Log.w(TAG,"BluetoothAdapternotinitializedorunspecifiedaddress.");}finalBluetoothDevice
我正在尝试连续读取BLE设备的特性。我在我的服务类中创建了一个Runnable:privateclassBackgroundRunnableForReadimplementsRunnable{privatevolatilebooleanisRunning=true;@Overridepublicvoidrun(){try{BluetoothLeService.this.backgroundRunID=Thread.currentThread().getId();while(isRunning){ListgattServices=BluetoothLeService.this.getSu