我在我的应用程序中使用BluetoothManager私有框架,我想知道当应用程序处于后台时如何接收BluetoothManager通知(例如:在后台接收连接/断开连接的蓝牙通知)。
提前致谢。
Use
// 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);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)