收到后台BluetoothManager通知 [英] Receive BluetoothManager notifications in background

查看:184
本文介绍了收到后台BluetoothManager通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用我的应用程序的BluetoothManager私人框架,我想知道我怎么能收到BluetoothManager通知,当应用程序在后台(例如:在接收后台连接/蓝牙disconected通知)

I'm using the BluetoothManager private framework in my app and I want to know how can I receive BluetoothManager notifications when the application is in background (ex: Receive the connected/disconected bluetooth notification in background).

先谢谢了。

推荐答案

使用

// global notification explorer
CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(),
    NULL, MyCallBack, NULL, NULL, 
    CFNotificationSuspensionBehaviorDeliverImmediately);

和收到通知:

// global notification callback
void MyCallBack (CFNotificationCenterRef center,void *observer,CFStringRef name,const void object,CFDictionaryRef userInfo)
{
    NSLog(@"CallBack:CFN Name:%@ Data:%@", name, userInfo);
}

这篇关于收到后台BluetoothManager通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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