Android / iOS - BLE - wake up a terminated application when a BLE device connects

て烟熏妆下的殇ゞ 提交于 2019-12-06 13:48:59

问题


Iam creating an iOS and an Android application that read some data from a bluetooth sensor and saves them in a db.

I want to give the ability to save the sensor's data even when the application is terminated.

fyi. I have already managed to read the sensor in both iOS and Android while the app is the background.

But my concern is on how to make the following scenario work:

-Sensor is disconnected from the phone -User terminates the application from the task manager -User connects (and pairs) the BLE sensor to the device -The application wakes-up in the background and reads the sensor's output and then goes back to sleep.

Any suggestions?


回答1:


For iOS this is possible as described in Apple doc Core Bluetooth Background Processing for iOS Apps.

For Android you could start a Service (by your app and also on device boot) and (re)connect to the device.

Also you could post a local notification in iOS/Android background Service - and when the user touches it, start the BLE app.



来源:https://stackoverflow.com/questions/30397980/android-ios-ble-wake-up-a-terminated-application-when-a-ble-device-connect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!