简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM