标签: firebase-notifications

Firebase推送通知无效

我开发了一个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 firebase firebase-notifications

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

FCM - 在onMessageReceived中设置徽章

我有一个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

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

应用程序处于后台时,FCM推送通知显示白色方形图标而不是应用程序图标

我在我的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

8
推荐指数
1
解决办法
2953
查看次数

在 Firebase 通知中发送表情符号

这里有一个两部分的问题:

  1. 如何通过 Firebase 通知发送表情符号?我尝试输入消息正文为“\ U1F44D”的竖起大拇指表情符号的消息,但是当通知通过时,它没有在我的手机上呈现。

  2. 如何在 node.js 文件中格式化通知负载?我想它与输入对应的特定 unicode 字符相同,但我似乎无法正常工作......要么我错过了一些魔法,要么没有使用正确的代码。

谢谢!

unicode emoji firebase firebase-cloud-messaging firebase-notifications

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

没有从控制台接收firebase通知

我通过firebase控制台发送后没有收到通知,我尝试发送了很多通知,但收到了大约20个通知中的一两个,我按照github的指南firebase消息 ,为什么我没有收到通知,我的应用程序安装在一个模拟器中并且在我的一部电话中但是当我收到通过通知面板发送的通知时,我通过电话或模拟器得到它们从来没有得到它们.

下面是我的控制台的屏幕截图 在此输入图像描述

android firebase firebase-notifications

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

基于Firebase控制台的通知中的邮件文本的字符限制是多少?

我正在使用Firebase控制台向我的手机发送通知,通知已成功发送到我的手机,但我想知道,基于Firebase控制台的通知中的消息文字的字符数限制是多少?

在此输入图像描述

android push-notification firebase firebase-notifications

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

Firebase云消息传递验证令牌与注册令牌

firebase.auth().getToken()通过Android设置返回的FCM注册令牌之间是否存在差异:FirebaseInstanceId.getInstance().getToken()?我目前正在使用https://www.npmjs.com/package/firebase,它使用上面的第一种方法来设置auth并生成令牌.尝试发送通知时使用该令牌返回:错误:InvalidRegistration ...

firebase-authentication firebase-cloud-messaging firebase-notifications

7
推荐指数
1
解决办法
2577
查看次数

单击 Android Firebase 推送通知会重新启动应用程序

当收到 Firebase 推送通知时,当应用处于后台时,Firebase 会自动显示通知。

此通知中包含的待处理 Intent 似乎始终包含该FLAG_ACTIVITY_NEW_TASK标志,这将导致在单击通知时重新启动应用程序,即使该应用程序已在后台处于活动状态。

有什么方法可以防止这种行为,而只是onNewIntent(intent)在主 Activity 上调用?

android firebase firebase-cloud-messaging firebase-notifications

7
推荐指数
1
解决办法
2939
查看次数

不同语言通知 Firebase

如果设备是英文的,我如何发送通知并发送其他所有语言的通知?

我试图让两个不同的观众,但两个观众都是空的。

push-notification ios firebase swift firebase-notifications

7
推荐指数
1
解决办法
4120
查看次数

Flutter - 无法设置通知大图标

我正在使用:flutter_local_notifications:^5.0.0+3

我正在显示这样的通知,一切正常。自定义图标也有效。但我试图设置一个大图标,但它只是没有显示。这是没有任何大图标的通知的屏幕截图:

更新 - 当我锁定手机时会显示,并且通知显示在锁定屏幕上。但是,当它在屏幕上弹出时,它不会显示。另外,当我向下滑动并查看列表中的所有通知时,它不会显示。仅在锁定屏幕上。为什么会这样呢?

无图标

这是我的代码:

class _MyAppState extends State<MyApp> {

  FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;

  FirebaseMessaging messaging = FirebaseMessaging.instance;

  @override
  void initState() {
    notificationPermission();
    initMessaging();

    subscribeToTopic('test');

    createChannel();


    super.initState();
  }

  // users unique token
  void getToken() async {
    print(await messaging.getToken());
  }


  @override
  Widget build(BuildContext context) {



    getToken();
    // showNotification();

    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(

        primarySwatch: Colors.blue,
      ),
      home: Scaffold(

        appBar: AppBar(title: Text('AppBar Demo')),



      ),
    );
  }




  void notificationPermission() async {

    NotificationSettings settings = await messaging.requestPermission(
      alert: true,
      announcement: false,
      badge: true, …
Run Code Online (Sandbox Code Playgroud)

flutter firebase-notifications flutter-notification

7
推荐指数
1
解决办法
7608
查看次数