iOS BLE

编程入门 行业动态 更新时间:2024-10-10 17:31:33
本文介绍了iOS BLE-如何使应用程序在后台保持活动状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试找到一种巧妙的方法来在iOS 6上保持BLE应用程序在后台运行,而又不会违反苹果的任何规则.我计划将电话用作外围设备,并使用另一个BLE电路作为中央设备.当用户使用地理围栏到达建筑物时,我的应用程序将自动打开.之后,iPhone将连接到它看到的第一个BLE中央设备(该设备将在其白名单中).然后,用户将能够在整个建筑物中移动,切换到不同的BLE节点".

I am trying to find a clever way to keep a BLE app active in the background on iOS 6, without breaking any of Apple's rules. I plan to use the phone as a peripheral device and another BLE circuit as the central. My app will automatically be opened when a user arrives to a building using geofencing. After that the iPhone will connect to the first BLE central device it sees (the device will be in its white list). The user will then be able to move throughout the building switching to different BLE "nodes".

我的问题是:当用户固定在办公桌旁时,该后台该怎么办,以使该应用不会由于内存资源而挂起?

My question is: What do I need to do in the background when a user is stationary at their desk so that the app does not get suspended due to memory resources?

我的想法基于此解决方案的一个单独问题:在仅有几个BLE节点"的区域中,可能(不定期)有10-50个用户,我在bluetooth上阅读了可以设置一个动态连接系统,基本上是通过所有用户旋转连接.

My idea is based on this solution for a separate problem: There could potentially (not regularly) be 10-50 users in an area with only a few BLE "nodes" and I read at bluetooth that I could setup a dynamic connection system, basically rotating connections through all the users.

我的想法是建立一个类似的动态系统,在该系统中,中央设备(不是iPhone)会定期(30-40分钟)断开设备的连接,然后iPhone将重新连接.

My idea is to setup a similar dynamic system where the central device (not the iPhone) disconnects the device on regular intervals (30-40 minutes) and then the iPhone will reconnect.

这是否可行?这违反iOS开发指南吗?我找不到任何明确的信息.我也曾在iOS开发者论坛上提问,但不幸的是,它不像该网站那样受欢迎.

Is this something that some feasible? Is this against the iOS development guidelines? I was unable to find anything explicit about this. I have also asked on the iOS developer forum, but unfortunately it is not as popular as this site.

提前谢谢!

推荐答案

Xcode->项目目标->功能->启用后台模式

Xcode -> Project target -> Capabilities -> Enable background mode

检查使用的蓝牙LE配件

Check Uses Bluetooth LE Accessories

功能

还要在.plist文件中启用以下密钥

Also enable the following key in .plist file

所需的背景模式

应用程序使用CoreBluetooth进行通信

App communicates using CoreBluetooth

Plist

更多推荐

iOS BLE

本文发布于:2023-11-24 21:56:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1627005.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:iOS   BLE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!