如何从Firebase控制台向特定GCM/FCM设备令牌ID发送推送通知 [英] How to send a push notification from the Firebase console to a specific GCM/FCM device token ID

查看:282
本文介绍了如何从Firebase控制台向特定GCM/FCM设备令牌ID发送推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Urban Airship中,当我编写通知时,可以通过搜索Urban Airship channel_id(设备ID)来定位特定用户:

In Urban Airship, when I am composing a notification, I can target specific users by searching for a Urban Airship channel_id (device ID):

我从Urban Airship发送了上面显示的推送通知,并成功收到了该通知.现在,我想做同样的事情,将推送通知发送到特定设备,但是现在使用Firebase控制台.问题是在Firebase中,在我需要指定target的步骤中,它仅允许我选择User segmenttopic.我期望看到第三个选项:Target specific users(用于将通知发送到一个或多个特定的GCM/FCM设备令牌ID.因此,我的替代方法是将GCM/FCM设备令牌ID添加到topic,然后发送推送通知到该主题,这是我之前成功完成的事情.尽管如此,这将是一种解决方法,而不是我更喜欢这样做的方式.是否可以将推送通知发送给特定用户(通过定义目标GCM /FCM设备令牌ID)从Firebase控制台获得?谢谢.

I sent from Urban Airship the push notification that I am showing above, and I received it successfully. Now I want to do the same thing, send a push notification to a specific device, but now using the Firebase console. The problem is that in Firebase, in the step where I need to specify the target, it only allows me to choose User segment or topic. I was expecting to see a third option: Target specific users (for sending notifications to one or many specific GCM/FCM device token IDs. So my alternative is to add a GCM/FCM device token ID to a topic and then send the push notification to that topic, which is something that I have successfully done before. Nonetheless, that would be a workaround and not the way I would prefer to do this. Is it possible to send push notifications to specific users (by defining the target GCM/FCM device token IDs) from the Firebase console? Thank you.

更新1:了解Firebase控制台的方式( https://console.firebase .google.com/)仅将User segmentTopic显示为Target:

UPDATE 1: See how the Firebase console (https://console.firebase.google.com/) only shows User segment and Topic as the Target:

推荐答案

根据设计,控制台中的通知功能用于发送广播类型的事件.发送特定于用户的警报将更多是通过API进行的编程操作.

By design, the notification feature in the console is for sending out broadcast-type events. Sending user-specific alerts would be more of a programmatic operation done through the API.

要发送测试消息,有一个控制台工具可以对此进行解释,这里.

For sending test messages, there is a console tool for this, explained here.

请注意,可以通过

Note that it is possible to send a notification to one device by subscribing a device to any topic and sending the notification to that topic in the console (keep in mind topics are public and you can't prevent users from signing up to them; fine for testing most likely).

另一种替代方法是通过HTTP或curl发送消息.也许最好的资源是 quickstart/messaging示例.

Another alternative is to send a message via HTTP or curl. Perhaps the best resource for this is the quickstart/messaging example.

这篇关于如何从Firebase控制台向特定GCM/FCM设备令牌ID发送推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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