简体   繁体   English

iOS CoreBluetooth后台模式通知

[英]IOS corebluetooth Background mode notification

Currently am working with the project using core bluetooth. 当前正在使用核心蓝牙进行该项目。 In which am using background mode communication, am able to receive the notification when ever app running in background but we have only one service and one characteristics for data communication based on frame type we are able to identify the frames which is received. 在其中使用后台模式通信的情况下,能够在应用程序在后台运行时接收通知,但是我们只有一种服务和一项基于帧类型的数据通信特征,我们能够识别接收到的帧。

For background mode i used this code 对于后台模式,我使用了此代码

[centralManager connectPeripheral:activePeripheral options:@{CBConnectPeripheralOptionNotifyOnConnectionKey: @YES,
    CBConnectPeripheralOptionNotifyOnDisconnectionKey: @YES,
    CBConnectPeripheralOptionNotifyOnNotificationKey: @YES}];

its working fine for both event and session background. 对于事件和会话背景,它都可以正常工作。

Event background alert shows for every notification is there any way to hide the alert for every notification show only needed. 事件背景警报显示的每个通知是否有隐藏任何仅显示通知的警报的方法。

Thanks 谢谢

In event mode the alerts are generated by the system and as long as your app is not activated, it can't do anything about them. 事件模式下 ,警报是由系统生成的,只要您的应用未激活,它就无能为力。

In session mode the app stays responsible for handling all these events. 会话模式下 ,应用负责处理所有这些事件。 It receives all the callbacks just as in the foreground. 它像前台一样接收所有回调。 If you want to minimize the disturbance of the user, you should take over the alert generation with this mode. 如果要最大程度地减少对用户的干扰,则应使用此模式来接管警报生成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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