您可以将来自 App 端的传入推送通知静音吗 [iOS] [英] Can you mute incoming Push Notifications from the App side [iOS]
问题描述
我正在制作一个使用 Apple 推送通知的应用程序.我希望能够有一个下班"模式,在这种模式下仍然会收到推送通知,但是当它进来时不播放声音.有没有办法从应用程序内部将这些推送通知静音?我知道我不能简单地从 JSON 消息发送声音,但如果我可以从应用程序内部发送声音会更容易.我想仍然收到通知,所以我不想取消注册推送通知
I am making an app that uses Apples Push Notifications. I want to be able to have an "off duty" mode, in which the push notification is still received, but no sound is played when it comes in. Is there a way to mute these push notifications from inside the app? I know I can simply not send the sound from the JSON message, but it would be easier if I could do it from inside the app. I want to still receive the notifications, so I don't want to unregister from push notifications
推荐答案
如果您的应用在后台,则使推送静音的唯一方法是不从 JSON 消息中发送声音.
If your app is in background, the only way to mute the push is not send the sound from the JSON message.
当您的应用在前台时,您将通过 application:didReceiveRemoteNotification: 接收推送,在这种情况下,无论您是否发送声音,应用都会静默接收推送.
When your app is foreground, you will receive push by application:didReceiveRemoteNotification:, in this case, whether your send sound or not, app will receive push silently.
这篇关于您可以将来自 App 端的传入推送通知静音吗 [iOS]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!