我用我的应用程序的BluetoothManager私人框架,我想知道我怎么能接受BluetoothManager通知,当应用程序在后台(例如:接收在后台连接/蓝牙disconected通知)。
提前致谢。
我用我的应用程序的BluetoothManager私人框架,我想知道我怎么能接受BluetoothManager通知,当应用程序在后台(例如:接收在后台连接/蓝牙disconected通知)。
提前致谢。
采用
// 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);
}