简体   繁体   English

停止播放声音推送通知

[英]stop playing sound push notification

Tried to find this already but can't find any questions which are asking quite the same thing. 试图找到这个,但找不到任何问同样事情的问题。

Basically I have set up my push notifications, everything works fine and they are received both when the app is open and closed. 基本上我已经设置了推送通知,一切正常,并且在应用程序打开和关闭时都会收到它们。

I recieve push, sound begins play. 我收到推,声开始播放。 For some reason i need to cancel sound without active app. 出于某种原因,我需要在没有活动应用的情况下取消声 Skype have this feature. Skype有此功能。 When app is suspended, incoming call start to play sound by push. 当应用程序暂停时,来电开始播放声音。 After call cancelation sound stops. 呼叫取消后声音停止。

UPD: Is there a way to cancel the sound like Skype? UPD:有没有办法像Skype那样取消声音? When Skype app is suspended iPhone receives PUSH for incoming call. 当Skype应用程序暂停时,iPhone会收到PUSH来电。 Sound begins playing. 声音开始播放。 When call cancel at other side iPhone stops play sound by second push. 当在另一侧的呼叫取消时iPhone通过第二次推动停止播放声音。 Anyone knows how this feature works? 谁知道这个功能是如何工作的?

You specify a bitmask of notification types when you register for notifications. 注册通知时,请指定通知类型的位掩码。 If you don't want a sound to be played when notifications come in, remove UIRemoteNotificationTypeSound from that bitmask 如果您不希望在通知进入时播放声音,请从该位掩码中删除UIRemoteNotificationTypeSound

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge)];

I think they're using invisible push to trigger a local notification. 我认为他们正在使用隐形推送来触发本地通知。 Local notification may be cancelled, so they then cancel it when needed. 本地通知可能会被取消,因此他们会在需要时取消。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM