如何在我的应用程序中获取推送通知设置?

发布于 2024-12-05 18:47:09 字数 343 浏览 0 评论 0原文

我正在开发一个 iPhone 应用程序,其中包含并处理自定义声音文件的苹果推送通知。当我从常规设置中设置通知声音关闭时,当应用程序未处于运行状态时,通知声音会按我的预期关闭。但是当应用程序处于运行状态时,我需要手动处理声音播放或停止。那么我如何获取通知声音相关的设置,无论是打开还是关闭? 我可以在 didReceiveRemoteNotification 中获取以下设置 方法

alert = 收到新的 UFO 信息,徽章 = 1,声音 = Alarm1.wav

如果有人有任何关于获取常规设置(例如警报声音打开或关闭)的想法,请提供帮助。

提前致谢。

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 Information 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

孤凫 2024-12-12 18:47:09

首先检查您的应用程序状态并使用此代码打开推送通知设置。

适用于 iOS 5 及更高版本。

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=NOTIFICATIONS_ID"]];

要打开 iPhone 应用程序的任何设置,请检查此链接。

http://www.makebetterthings。 com/iphone/open-settings-app-in-iphone-using-open-url-scheme/

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/

过期以后 2024-12-12 18:47:09
 - (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
       if ([application enabledRemoteNotificationTypes] & UIRemoteNotificationTypeSound) {
         AudioServicesPlaySystemSound(0x3f4);
         AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
        }
     }
 - (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
       if ([application enabledRemoteNotificationTypes] & UIRemoteNotificationTypeSound) {
         AudioServicesPlaySystemSound(0x3f4);
         AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
        }
     }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文