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

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

问题描述

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

Display my push notification message is "Message from: +919687335565"

附截图:

attached screenshot :

我只想从地址簿此联系人的显示姓名中获取这个+919687335565联系电话的名字,而不是push中的电话号码通知.

I just want to fetch the name of this +919687335565 contact number from the Address book and display name of this contact instead of a phone number in push notification.

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

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天全站免登陆