的Andr​​oid / iOS版 - BLE - 唤醒一个应用程序终止时,BLE设备连接上 [英] Android / iOS - BLE - wake up a terminated application when a BLE device connects

查看:391
本文介绍了的Andr​​oid / iOS版 - BLE - 唤醒一个应用程序终止时,BLE设备连接上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

荫创建iOS和从蓝牙传感器读取一些数据,并在数据库保存他们的Andr​​oid应用程序。

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.

仅供参考。我已经成功地读取iOS和Android上的传感器,而应用程序是在后台。

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是从手机断开
- 用户终止从任务管理器应用程序
- 用户连接(以及对)的BLE传感器到装置
-The应用唤醒后在后台并读取传感器的输出,然后接着睡。

-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.

有什么建议?

推荐答案

对于iOS,这是尽可能在苹果DOC <一个描述href=\"https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html\"相对=nofollow>核心蓝牙后台处理的iOS应用。

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

有关Android的,你可以开始服务(由您的应用程序和也设备启动)和(重新)连接到该设备。

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

你也可以张贴在的iOS / Android的后台服务本地通知 - 当用户触摸它,启动BLE应用

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

这篇关于的Andr​​oid / iOS版 - BLE - 唤醒一个应用程序终止时,BLE设备连接上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆