从iOS端在设备上显示之前可以更改推送通知消息吗? [英] It's possible to change push notification message before display on device from iOS side?

查看:118
本文介绍了从iOS端在设备上显示之前可以更改推送通知消息吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显示我的推送通知消息来自:+919687335565

Display my push notification message is Message from: +919687335565

附加屏幕截图:

attached screenshot :

我只想从地址簿显示名称中获取此+919687335565联系电话的名称此联系而非推送通知中的电话号码

在显示通知之前,我想用替换电话号码+919687335565 >推送通知中的联系人姓名Chandresh

Before displaying notification i want to replace phone number +919687335565 with its contact name Chandresh in push notification.

如附加屏幕截图:

like attached screenshot :

推荐答案

在iOS上预处理和修改通知的有效负载有各种可能性。

There are various possibilities for preprocessing and modify the payload of a notification on iOS.

在iOS 10之前

您可以发送无声通知,什么不会显示给用户。将终止或在后台唤醒我们的应用程序,您将能够对通知内容进行预处理。查看更多信息此处,如何设置它。但是,此通知类型不是100%可靠,并且不应滥用,例如,用于所有要发送的通知,因为Apple可以停止在一些消息之后发送通知。

You could be sending Silent Notifications, what will not be not shown to the user. Will wake our application when it is terminated or in background, and you will be able to do preprocessing on the notification content. See more info here, how to set it up. However, this notification type is not 100% reliable, and should not be abused, e.g. used for all notifications to be delivered, because Apple could stop the notifications to be sent after a number of messages.

另一种选择是,如果您的应用程序支持 VoIP 。这样,您的应用程序几乎总是会听取推送通知,并且您将始终可以预先处理通知,然后再显示它们。但是,如果您的应用没有真正的 VoIP 功能,例如电话,Apple会在评论时拒绝您的应用。 这里是一个很棒的教程,如何设置它。

The other option is, if your application supports VoIP. This way your app will pretty much always listen to push notifications, and you will be always available to preprocess the notifications, before you would be displaying them. However, if your app does not have real VoIP capabilities, e.g. phone calls, your app will be rejected by Apple on the review. Here is a great tutorial, how to set it up.

来自iOS 10

随着iOS 10的推出,我们终于可以进行预处理了甚至,当应用程序处于后台或终止时,我们的通知。无 VoIP 功能或需要发送的特殊通知类型。 此处是一个很棒的教程,如何设置。

With the introduction of iOS 10, we are finally able to do preprocessing on our notifications, even, when the app is in background or terminated. No VoIP capabilities or special type of notifications needed to be sent. Here is a great tutorial, how to set it up.

这篇关于从iOS端在设备上显示之前可以更改推送通知消息吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆