简体   繁体   English

更改传入的推送通知的内容

[英]Change the content of an incoming push notification

有没有办法在推送通知出现在手机上之前或之后立即用代码更改(替换)推送通知的传入文本消息?

No. If you're app isn't running then your app doesn't get to even see the push notification before it is displayed to the user or even know its arrived. 否。如果您的应用程序未运行,则您的应用程序甚至在向用户显示推送通知或什至不知道推送通知到来之前都无法看到它。

If it was running when the push arrived then you can display a location notification (which to the user looks like the same thing). 如果在推送到达时它正在运行,那么您可以显示位置通知(对用户而言,它看起来像是同一件事)。

However that's the situation for standard push notifications, with iOS7 your app could receive background silent push notifications* and then post a location notification to the user which would achieve the same thing you want. 但是,这就是标准推送通知的情况,在iOS7中,您的应用可以接收后台静默推送通知*,然后向用户发布位置通知,这将实现您想要的效果。

(*provided the user hasn't explicitly terminated the app or it hasn't crashed) (*前提是用户尚未明确终止该应用或该应用没有崩溃)

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

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