相关疑难解决方法(0)

如何在FCM通知中创建主题

我正在尝试使用Firebase-Notification API,当我将下游消息从控制台发送到应用程序时,该服务是完美的,但如何向主题注册用户发送消息?

我在android方面做过

FirebaseMessaging.getInstance().subscribeToTopic("TopicName");
Run Code Online (Sandbox Code Playgroud)

但当我尝试从控制台向主题发送下游消息时,它说

This project does not have any topics
Run Code Online (Sandbox Code Playgroud)

编辑:我发现在映射主题后,最多需要1天才能显示在Firebase控制台中

android firebase google-cloud-messaging firebase-notifications

67
推荐指数
4
解决办法
6万
查看次数

从android中的firebase发送通知时没有通知声音

我正在从firebase向我的Android应用程序发送推送通知.但是当我的应用程序处于后台时,不会调用firebase onMessageReceived方法而是调用firebase向系统发送通知,以便在系统托盘中显示通知.通知出现在系统托盘中但没有通知声音,即使我已在系统设置中允许我的应用程序发出通知声音.

当从firebase收到通知时,我可以做什么来播放通知声音.

这就是我从firebase向我的应用Blogpost链接发送通知的方式.

如何在Android应用程序中添加firebase

notifications android push-notification firebase firebase-cloud-messaging

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

设备未收到Firebase云消息传递通知

我有火力点云信息的问题,我从设备获取的令牌,并不过,在透过谷歌火力地堡通知控制台发送通知测试,该通知从未登录,也被推到了Android的虚拟设备.对于FCM的文档几乎一模一样,我有以下及一些其它在还有什么你必须做的就是推送通知与火力的工作方式的代码.我已经完成了所有的设置信息了(的build.gradle增加,安装谷歌播放服务等)的文件中规定,但仍然没有消息产生.我按下通知后立即收到一次性错误,指出"I/FA:找不到标签管理器,因此不会被使用",但这是唯一输出的数据,我没有找到与标签相关的任何内容经理要求和谷歌上的FCM.我没有收到对logcat或设备的推送通知的代码有什么问题?请让我知道任何有用的进一步信息.谢谢.

NotificationGenie.java

public class NotificationGenie extends FirebaseMessagingService {

private static final String TAG = "Firebase_MSG";

@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 a received FCM
    // message, here is where that should be initiated. See sendNotification method below.
    sendNotification(remoteMessage.getNotification().getBody());
    Log.d(TAG, "From: " + remoteMessage.getFrom());
    Log.d(TAG, "Notification …
Run Code Online (Sandbox Code Playgroud)

android firebase google-cloud-messaging firebase-cloud-messaging

55
推荐指数
11
解决办法
11万
查看次数

Firebase可扩展通知当应用在后台时显示图像

我正在Android中实施FCM通知,但通知如何根据应用状态(背景与前景)而有所不同?

看通知图片

我使用带有Postman的FCM API发送通知,这是通知结构:

{ "notification": {
      "title": "Notification title",
      "body": "Notification message",
      "sound": "default",
      "color": "#53c4bc",
      "click_action": "MY_BOOK",
      "icon": "ic_launcher"
   },
   "data": {
       "main_picture": "URL_OF_THE_IMAGE"  
   },
   "to" : "USER_FCM_TOKEN"
}
Run Code Online (Sandbox Code Playgroud)

要渲染的图像取自data.main_picture.

我实现了自己的功能FirebaseMessagingService,使通知在前景状态下完美显示.通知代码是下一个:

NotificationCompat.BigPictureStyle notiStyle = new NotificationCompat.BigPictureStyle();
notiStyle.setSummaryText(messageBody);
notiStyle.bigPicture(picture);

Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

NotificationCompat.Builder notificationBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher)
            .setLargeIcon(bigIcon)
            .setContentTitle(title)
            .setContentText(messageBody)
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .setContentIntent(pendingIntent)
            .setStyle(notiStyle); code here

NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());
Run Code Online (Sandbox Code Playgroud)

但是,在后台,甚至没有执行该服务.在AndroidManifest.xml,Firebase服务声明如下:

<service
    android:name=".MyFirebaseMessagingService">
  <intent-filter>
    <action android:name="com.google.firebase.MESSAGING_EVENT"/>
  </intent-filter>
</service>

<service …
Run Code Online (Sandbox Code Playgroud)

android background push-notification firebase-cloud-messaging

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

如何在#flutter 中更改推送通知的 Android 通知图标/状态栏图标?

我想用我自己的推送通知图标替换默认图标。

现在应用程序将图标显示为白框。

push-notification flutter

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

灰色方块作为使用Firebase通知的通知图标

我正在尝试将Firebase Cloud Messaging集成到我的Android应用程序中.但是,当应用在后台或已关闭时,Firebase通知会显示灰色方块图标,而不是应用程序的启动器图标.

如何在不实施Firebase服务器API和发送数据消息的情况下将通知图标设为我的应用程序徽标?

android firebase-cloud-messaging

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

如何在Firebase应用通知中设置更大的图标?

嗨,我正在使用Firebase在Android中实现推送通知.现在,在一个圆圈内有一个小图标.我需要它以更大的尺寸显示.请看图像.这是我的代码,

            android:id="@+id/relativeNotification"

            android:layout_width="192dp"
            android:layout_height="192dp"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true">

            <com.inspius.coreapp.widget.TintableImageView
                android:layout_width="192dp"
                android:layout_height="192dp"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:layout_gravity="center_vertical"
                android:contentDescription="@string/app_name"
                android:src="@drawable/ic_launcher"
                app:tint="@color/custom_icon_video_detail_selector" />
Run Code Online (Sandbox Code Playgroud)

如何从这个小图标设置大图标?

这是图像

android android-notifications firebase firebase-cloud-messaging

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

Android通知图标是一个白色圆圈

我今天的通知图标出现了一个奇怪的问题。

看起来像这样: 在此处输入图片说明 (白圈...)

我做了不好的事吗?

Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.icon_notification)
                .setContentTitle(this.getString(R.string.notification_title))
                .setContentText(this.getString(R.string.notification_text))
                .setAutoCancel(true)
                .setSound(defaultSoundUri)
                .setContentIntent(pendingIntent);
Run Code Online (Sandbox Code Playgroud)

这里是我的图标图像(从这里下载的最新https://material.io/icons/#ic_photo): http://image.noelshack.com/fichiers/2016/44/1478185219-icon-notification.png

我错过了什么 ?

作为记录,我使用的是SDK 24,目前仅创建了hdpi资源文件夹。

编辑#1:我已经添加了ldpimdpi并且xhdpi图标,没有什么变化?

编辑#2:为了更精确,我正在尝试从服务... FCM消息传递服务...创建此通知。

notifications icons android

7
推荐指数
3
解决办法
6239
查看次数

android Firebase 云消息通知图标

我在我的项目中使用了 FCM,效果非常好。但有一个问题:在某些 Android 设备上,显示的是圆形灰色圆圈,而不是彩色应用程序图标(当未设置自定义默认图标且通知负载中未设置图标时)。为什么会发生这种情况以及我应该使用什么样的图标?我应该使用元数据标签设置自定义默认图标吗?错误的图标

android push-notification android-notifications firebase-cloud-messaging

6
推荐指数
1
解决办法
2868
查看次数

Firebase通知白圈问题

我有一个问题Firebase Notification,如果我在应用程序在屏幕上运行时发送通知,则通知会正确显示,如下所示:

在此处输入图片说明

在此处输入图片说明

比起当我在后台运行应用程序时发送通知,通知显示如下:

在此处输入图片说明

在此处输入图片说明

这是我的FirebaseMessagingService

    public class AppFirebaseMessagingService extends FirebaseMessagingService {

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        sendNotification(remoteMessage);
    }

    private void sendNotification(RemoteMessage remoteMessage) {
        Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        int icon = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? R.drawable.ic_video_label_white_24dp: R.drawable.ic_launcher;
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
        notificationBuilder.setWhen(System.currentTimeMillis());
        notificationBuilder.setColor(ContextCompat.getColor(this, R.color.colorPrimary));
        notificationBuilder.setSmallIcon(icon);
        notificationBuilder.setContentTitle(remoteMessage.getNotification().getTitle());
        notificationBuilder.setContentText(remoteMessage.getNotification().getBody());
        notificationBuilder.setAutoCancel(true);
        notificationBuilder.setSound(defaultSoundUri);
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            Intent resultIntent = new Intent(this, MainActivity.class);
            TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
            stackBuilder.addParentStack(MainActivity.class);
            stackBuilder.addNextIntent(resultIntent);
            PendingIntent pendingIntent = stackBuilder.getPendingIntent(0,PendingIntent.FLAG_UPDATE_CURRENT);
            notificationBuilder.setContentIntent(pendingIntent);
            notificationBuilder.setPriority(Notification.PRIORITY_HIGH);
        }

        NotificationManager notificationManager =
                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); …
Run Code Online (Sandbox Code Playgroud)

java android firebase firebase-cloud-messaging

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