标签: firebase-notifications

当点击 Firebase 通知时显示特定的 Activity

当用户点击从 Firebase 控制台发送的通知时,我需要启动一个特定的 Android Activity,只有当用户点击通知时。如何在以下 2 种情况下完成此操作:

  1. 应用程序未打开或应用程序在后台运行
  2. 应用程序在前台

android-activity firebase firebase-cloud-messaging firebase-notifications

5
推荐指数
1
解决办法
5462
查看次数

点击FCM通知消息时如何获取消息正文?

当应用程序处于后台时,通知消息通过通知发送,当通知点击时,应用程序启动,我如何获取消息正文?

意图是这样的:

    Bundle[{google.sent_time=1470813025421, from=568540028909, 
google.message_id=0:1470813025865549%31bd1c9631bd1c96,
 collapse_key=com.google.firebase.quickstart.fcm}]
Run Code Online (Sandbox Code Playgroud)

意图没有消息体,只有消息ID!谢谢!

android android-notifications firebase-cloud-messaging firebase-notifications

5
推荐指数
1
解决办法
3734
查看次数

在没有用户点击通知的情况下处理数据负载?

在后台,应用程序在通知托盘中接收通知负载,并且仅在用户点击通知时处理数据负载。

有没有办法在用户不点击通知的情况下处理数据有效负载?

android android-notifications firebase-cloud-messaging firebase-notifications

5
推荐指数
1
解决办法
3400
查看次数

Firebase 通知没有以高优先级发送

当我通过 Firebase 网络界面向我的 Android 设备发送通知时,通知不会从状态栏向下窥视。如果我想看到通知,我必须向下滑动。即使我High在 Web 界面中将优先级设置为,也会发生这种情况。为什么是这样?

如果在应用程序打开时收到通知,这不是问题,因为我可以在我的FirebaseMessagingService班级中自己设置优先级:

public class MyFirebaseMessagingService extends FirebaseMessagingService {

  @Override public void onMessageReceived(RemoteMessage remoteMessage) {
    super.onMessageReceived(remoteMessage);
    sendNotification("Message Body");

  }

  /**
   * Create and show a simple notification containing the received FCM message.
   *
   * @param messageBody FCM message body received.
   */
  private void sendNotification(String messageBody) {
    Intent intent = new Intent(this, SubscribedActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
        PendingIntent.FLAG_ONE_SHOT);

    Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-notifications

5
推荐指数
1
解决办法
8125
查看次数

如何在JavaScript中测试Firebase通知OnTokenRefresh方法调用?

我已经创建了一个Firebase通知Web应用程序。当我从Web应用程序登录时,我生成FCM令牌并将其发送到我的API服务器,这工作正常。我在代码中编写了onTokenRefresh方法,但无法测试此代码。有什么方法可以测试此代码?

firebase.initializeApp(config);
messaging = firebase.messaging();


// Get Instance ID token. Initially, this makes a network call, once retrieved
      // subsequent calls to getToken will return from cache.
      messaging.requestPermission().then(function() {
        return messaging.getToken();
    }).then(function(currentToken) {
        if (currentToken) {
          sendTokenToServer(currentToken);
          updateUIForPushEnabled(currentToken);
        } else {
          // Show permission request.
          console.log('No Instance ID token available. Request permission to generate one.');
          // Show permission UI.
          updateUIForPushPermissionRequired();
          setTokenSentToServer(false);
        }
      })
      .catch(function(err) {
        console.log('An error occurred while retrieving token. ', err);
        showToken('Error retrieving Instance ID token. ', err); …
Run Code Online (Sandbox Code Playgroud)

javascript firebase firebase-cloud-messaging firebase-notifications

5
推荐指数
1
解决办法
2197
查看次数

在推送通知 Firebase 中发送 URL

我的应用程序当前正在从 Firebase 控制台接收文本、图像以及两者作为推送通知。我也想从 Firebase 控制台向应用用户发送一个 URL 作为通知。单击通知时。用户将被重定向到特定的 URL,例如。www.google.com如何在以下代码中执行此操作?

package com.example.khan.andronotification;

/**
 * Created by AndroidBash on 20-Aug-16.
 */
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.RingtoneManager;
import android.net.Uri;
import android.support.v4.app.NotificationCompat;
import android.util.Log;

import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;


public class MyFirebaseMessagingService extends FirebaseMessagingService {

    private static final String TAG = "FirebaseMessageService";
    Bitmap bitmap;

    /**
     * Called when message is received.
     *
     * @param remoteMessage Object representing the message …
Run Code Online (Sandbox Code Playgroud)

android push-notification firebase firebase-notifications

5
推荐指数
1
解决办法
2万
查看次数

上传APN认证Firebase的问题

我正在尝试使用Firebase将我的iOS应用配置为接收方通知.

如果我在没有密码的情况下导出证书和私钥并尝试在Firebase控制台上传它(生产或开发),我会收到错误"密码不正确".

如果我使用密码导出证书和私钥,我会收到错误"发生未知服务器错误"或"读取证书时出错".

我不明白为什么会这样.我确实按照教程.有人能帮我吗?

push-notification ios firebase firebase-notifications

5
推荐指数
1
解决办法
4670
查看次数

如何将Firebase消息发送到项目中的特定应用程序?

基于firebase,我对此表示怀疑。它允许为单个项目添加多个应用程序。我添加了App1,App2和App3。如何单独向App1发送通知?这三个应用程序的服务器密钥相同。

android firebase firebase-cloud-messaging firebase-notifications

5
推荐指数
1
解决办法
2235
查看次数

iOS:Firebase通知无法用于用户细分

我最近将我的项目升级到Swift3并将Firebase pod更新到4.0.0版.解决所有错误和警告后,当我尝试从控制台发送推送通知时.我发现单个设备推送通知发送工作正常.但是,发送到特定用户段不是; 这是我申请时最需要的.在向用户段发送推送时,我只是检查iOS捆绑包ID并尝试发送安装该应用程序的所有设备.

ios firebase swift3 firebase-notifications

5
推荐指数
1
解决办法
578
查看次数

FCM主题名称是否有任何限制?

我试图找出FCM的主题名称是否有任何限制.管理以查找有关主题数量的信息(无限制),但不包括主题名称或允许的字符长度.

firebase firebase-cloud-messaging firebase-notifications

5
推荐指数
1
解决办法
2265
查看次数