How can i fetch Push Notification settings in my app?
I am developing an iphone application which includes and process apple push notification for the custom sound file. When I set notification sound off from the general settings, notification sound is off as i expect, when app is not in running state. But when the app is in running state then i need to handle sound play or stop manually. So how can i fetch the notification sound related settings, whether it seted on or off? I am able to fetch following settings in didReceiveRemoteNotification method
alert = New UFO Infor开发者_开发百科mation received, badge = 1, sound = Alarm1.wav
If anybody have any idea about to fetch general settings like alert sound is on or off please help.
Thanks in advance.
First check your app staust and open push notification setting with this code.
For iOS 5 and later vesion.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=NOTIFICATIONS_ID"]];
For open any setting of iphone app check this link.
http://www.makebetterthings.com/iphone/open-settings-app-in-iphone-using-open-url-scheme/
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
if ([application enabledRemoteNotificationTypes] & UIRemoteNotificationTypeSound) {
AudioServicesPlaySystemSound(0x3f4);
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
}
精彩评论