我正在开发一个使用Firebase作为后端的聊天应用.需要在每个新消息接收器上获得推送通知,说明他收到了新消息.这是我第一次这样做,所以我有一个问题:
由于我们不使用自己的服务器,我们是否需要第三方提供商(例如Batch)来处理推送通知?如果我没有弄错的话,我认为Firebase不支持发送这样的推送通知,而只支持从控制台发送的推送通知.
任何帮助都会很棒.
push-notification ios firebase firebase-cloud-messaging firebase-notifications
对于我的应用,我希望用户安排他们收到特定通知的时间.我正在查看Firebase文档,但找不到允许我这样做的方法.有没有办法允许用户使用Firebase安排通知?我的应用程序仍在使用解析api,但截至目前,解析通知不支持计划推送.
android firebase google-cloud-messaging firebase-notifications
我根据手册安装了.
但只有当我将消息发送到所有iOS平台时,才会收到推送通知.但是当我将按摩发送到特定版本或特定设备进行测试时,设备上不会收到按摩.
可能是什么问题呢?
奇怪的是,当我使用新版本运行应用程序时,我没有在版本下拉列表中看到这个版本几天.即使代码确实达到了
FIRApp.configure()
Run Code Online (Sandbox Code Playgroud)
iphone push-notification ios firebase firebase-notifications
当我的应用程序打开并收到通知时,我希望能够立即打开相关活动,而无需用户点击通知.
这个问题非常相似:收到firebase通知的打开应用程序(FCM)
但它在应用程序处于后台时打开应用程序,我需要在应用程序处于前台时执行此操作.
当您的应用在后台时发送通知.在这种情况下,通知将传递到设备的系统托盘.用户点按通知会默认打开应用启动器.具有通知和数据有效负载的消息,包括后台和前台.在这种情况下,通知将传递到设备的系统托盘,并且数据有效负载将在启动器活动的附加内容中传递.
这是我的命令 onMessageReceived
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
}
// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
sendNotification( remoteMessage);
}
}
/**
* Create and show a simple notification containing the received FCM message.
*
* @param remoteMessage FCM message …Run Code Online (Sandbox Code Playgroud) android firebase firebase-cloud-messaging firebase-notifications
我通过Firebase Notification控制台向用户Android设备发送通知,我注意到即使我在用户设备离线时发送10个不同的通知,一旦用户上线,她/他将收到所有10个.
但是,在Firebase文档中,声明:
FCM允许应用服务器在任何给定时间使用每个设备最多四个不同的折叠键.换句话说,FCM连接服务器可以同时为每个设备存储四个不同的可折叠发送到同步消息,每个消息具有不同的折叠密钥.如果超过此数字,FCM仅保留四个折叠键,不保证保留哪些键.
那么用户不应该只收到4个通知吗?我错过了什么吗?(我没有扩展FirebaseMessagingService,我将通知处理留给SDK)
更新:如果您未在Firebase通知控制台中指定折叠键,则似乎会为通知分配隐式折叠键,即应用程序的包名称.getIntent().getExtras()一旦我通过点击通知启动应用程序,我已经通过检查密钥集的所有键/值对来测试了这一点.事实上,collapse_key即使我没有指定一个密钥,我也会得到一个包名称值的密钥.
更新2:我尝试通过扩展来处理通知FirebaseMessagingService,以便在应用程序位于前台时从通知控制台接收消息.我收到通知消息,并手动向用户显示通知.你猜怎么着.折叠键很棒!即使我使用相同的折叠键发送多个通知,我也会收到一条通知.但只有当应用程序在前台,因为火力地堡SDK不会调用这种情况显然onMessageReceived()当应用程序在后台,而是它处理通知本身.这是否意味着这是Firebase SDK的错误?(因为问题仅在SDK显示通知时发生)
所以问题仍然存在,为什么我收到所有10个通知,因为每个通知都有相同的折叠键?也许FCM错误?
我开发了一个android应用程序.我使用firebase进行通知.我阅读了firebase文档然后分别制作了它们.我可以使用InstanceID令牌向一台设备发送推送通知.但我无法向所有设备发送推送通知.请帮我.
MyFirebaseMessagingService.java
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "MyFirebaseMsgService";
/**
* Called when message is received.
*
* @param remoteMessage Object representing the message received from Firebase Cloud Messaging.
*/
// [START receive_message]
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// TODO(developer): Handle FCM messages here.
// If the application is in the foreground handle both data and notification messages here.
// Also if you intend on generating your own notifications as a result of …Run Code Online (Sandbox Code Playgroud) 我有一个Android应用程序,我正在使用一些方法在应用程序图标上显示通知编号.现在我想在收到通知时设置该号码.
我认为我应该在收到通知时设置数字,所以我在onMessageReceived方法中设置它.但是,我的问题是当我的应用程序处于后台时,onMessageReceived方法未被调用,因此未设置通知编号.
以下是我的代码.我在里面设置了号码onMessageReceived.我已经测试过setBadge方法并且可以验证它是否正常工作.问题是onMessageReceived没有调用所以setBadge也没有调用,没有设置数字.
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// TODO(developer): Handle FCM messages here.
Log.d(TAG, "From: " + remoteMessage.getFrom());
Conts.notificationCounter ++;
//I am setting in here.
setBadge(getApplicationContext(),Conts.notificationCounter );
Log.e("notificationNUmber",":"+ Conts.notificationCounter);
// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
}
// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message …Run Code Online (Sandbox Code Playgroud) android google-cloud-messaging firebase-cloud-messaging firebase-notifications
我在GCM中遇到问题,所以我迁移到FCM但我仍然遇到与令牌相关的问题.
我启动了我更新的应用程序,我检查了有300个新用户,其中200个正在获得令牌,100个没有获得任何令牌,这是一个非常关键的问题.
null令牌的任何解决方案?
我在我的Android应用程序中使用FCM来管理推送通知.当应用程序处于前台并且应用程序图标也可见(正确)时,它完全正常工作.但是当应用程序在后台运行时,我没有正确收到通知.而不是透明图标,它显示白色方形图标作为通知图标.我知道,FCM会自动处理后台操作.但我需要显示我的应用程序图标而不是那个白色图标.注意:我只使用透明图标.我也试过下面的编码
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/rt_transparent_icon" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@android:color/holo_blue_bright" />
Run Code Online (Sandbox Code Playgroud)
但是这些解决方案都没有对我有用.谁能告诉我该怎么做?
android firebase firebase-cloud-messaging firebase-notifications
这里有一个两部分的问题:
如何通过 Firebase 通知发送表情符号?我尝试输入消息正文为“\ U1F44D”的竖起大拇指表情符号的消息,但是当通知通过时,它没有在我的手机上呈现。
如何在 node.js 文件中格式化通知负载?我想它与输入对应的特定 unicode 字符相同,但我似乎无法正常工作......要么我错过了一些魔法,要么没有使用正确的代码。
谢谢!
unicode emoji firebase firebase-cloud-messaging firebase-notifications