Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android应用程序在工作数小时后停止接收可恢复数据_Android_Bluetooth_Bluetooth Lowenergy - Fatal编程技术网

android应用程序在工作数小时后停止接收可恢复数据

android应用程序在工作数小时后停止接收可恢复数据,android,bluetooth,bluetooth-lowenergy,Android,Bluetooth,Bluetooth Lowenergy,我正在开发一个应用程序,从Ble设备获取数据,在图表中绘制数据(使用MPAndroidChart),并将数据保存到文件中(使用bufferedWriter) 一切正常,但当我长时间运行应用程序时,突然应用程序不再接收任何数据,它不会卡住,因为当我按下活动中的按钮时,它会响应,而在Logcat中,当我按下屏幕时,它会响应 我在Logcat中看到数据接收日志停止出现,行“D/BluetoothGatt:onBluetoothStateChange:up=true onBluetoothStateCh

我正在开发一个应用程序,从Ble设备获取数据,在图表中绘制数据(使用MPAndroidChart),并将数据保存到文件中(使用bufferedWriter)

一切正常,但当我长时间运行应用程序时,突然应用程序不再接收任何数据,它不会卡住,因为当我按下活动中的按钮时,它会响应,而在Logcat中,当我按下屏幕时,它会响应

我在Logcat中看到数据接收日志停止出现,行“D/BluetoothGatt:onBluetoothStateChange:up=true onBluetoothStateChange:Bluetooth开启”出现4次。 在Android Profiler中,我看到在数据停止之前,分配的数据增长较慢(请参阅附图)。

要运行该应用程序,我使用的是三星Tab A(2016)Android 7

我不确定下一步应该检查什么,以及如何找出出现此问题的原因?
有什么建议吗?

那么你基本上是说蓝牙崩溃并重新启动了?我不确定到底发生了什么。没有崩溃异常,只是数据停止,BT不会重新启动。应用程序也没有崩溃,它是响应的。您是否为蓝牙状态更改()注册了BroadcastReceiver?这样你就可以检测到。我注册了广播接收器,当问题发生时没有打印日志…1。如果您从“设置”菜单切换蓝牙,是否会看到您的接收器被呼叫?2.在你接收数据的整个过程中,你的应用程序都在前台吗?3.如何通过反复读取特征或通过通知获取数据?4.如果在BluetoothGatt对象的数据停止后调用disconnect(),是否会收到onConnectionStateChange回调?