使用Firebase发送静音推送通知 [英] send mute push notification with firebase

查看:62
本文介绍了使用Firebase发送静音推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在晚上向用户发送通知.我不想播放任何声音,我只希望用户醒来时能在状态栏上看到它.

I want to send notification at night to the user. I do not want to play any sound, I just want the user to see it on his status bar when he wakes up.

如何在用户设备(Android和ios)上不播放声音的情况下发送推送通知?

How can I send push notification without playing sound on the user device ( both android and ios)?

推荐答案

从Firebase Notification Web控制台:

  • 您可以在高级选项中设置 sound = disabled

额外提示:您还可以设置相对于设备的投放类型:例如用户时区的上午8点.

Extra tip: you can also set a delivery type relative to the device: like 8am on the user timezone.

使用Firebase Cloud Messaging API:

  • 您可以发送无声音的通知消息:
    为此,请不要在 notification:{title:``..} json

,或者您可以发送数据消息: data:{key:value,key2:value2,..}
此消息不会触发任何自动通知,只会触发您的应用回调.然后添加代码以您喜欢的方式创建通知.

or you can send a data-message: data: {key: value, key2: value2, ..}
this message will not trigger any automatic notification, only your app callback. then you add code to create the notification in the way you prefer.

通知消息的参数列表:
https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support

List of parameters for notification-messages:
https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support

在此处阅读有关通知消息和数据消息的更多信息: https://firebase.google.com/docs/cloud-messaging/concept-options

Read more about notification-messages vs data-messages here: https://firebase.google.com/docs/cloud-messaging/concept-options

这篇关于使用Firebase发送静音推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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