iOS的7蓝牙 - 应用程序,即使手机重启后在处理事件的背景 [英] iOS 7 Bluetooth - app that handles events in background even after phone restart

查看:321
本文介绍了iOS的7蓝牙 - 应用程序,即使手机重启后在处理事件的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个跟踪应用程序,其中反应/记录当用户在汽车获取和手机蓝牙免提自动配对。我还需要免提设备的编号。

I want to write a tracking application, which reacts/record when users get in a car and phone automatically pair with Bluetooth hands free. I need also Id of the hands free device.

在Android上很容易,利用广播接收器你的应用程序收听广播该设备已配对的手机。据工作即使电话已经重新启动,应用程序没有重新启动后运行。

On Android it is easy, using Broadcast Receiver your app listen to broadcasts that device had been paired with phone. It is working even after phone had been restarted and App did not run after restart.

是否有可能在iOS(7+)?

Is it possible on iOS(7+) ?

推荐答案

您可以通过阅读<一的在后台执行长期行动的一部分做href=\"https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html\"相对=nofollow>这个文档

从本质上讲,使用状态恢复时,系统注意到什么,当它被杀死你的应用程序在做什么。结果
如果应用程序正在搜索蓝牙设备,并且由系统终止时,系统会照顾继续这一研究,并再次唤醒应用程序时的BT设备已经奔找到。结果
注意,这将仅当该应用是由系统杀死,而不是由用户(使用多任务巴)工作。因为iOS的7此行为已更改。

Essentially, using state restoration, the system takes note of what your app was doing when it was killed.
If the app is searching for a bluetooth device and is killed by the system, the system will take care of continuing this research and wake up the app again when the bt device has ben found.
Note that this will work only if the app is killed by the system, not by the user (using the multitask bar). This behavior has changed since iOS 7.

这篇关于iOS的7蓝牙 - 应用程序,即使手机重启后在处理事件的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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