相关疑难解决方法(0)

在棒棒糖版本上方的通知中设置小图标

我已经创建了抬头通知。如下所示,

NotificationCompat.Builder notification = new NotificationCompat.Builder(this, channelId)
                .setContentTitle("Message")
                .setContentText("Recieved Successfully")
                .setContentIntent(pendingIntent)
                //.setColor(ContextCompat.getColor(this, R.color.green))
                .setSmallIcon(R.drawable.notification_icon)
                .setDefaults(Notification.DEFAULT_ALL)
                .setContentIntent(pendingIntent)
   .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
                .setAutoCancel(true)
                .setPriority(NotificationCompat.PRIORITY_HIGH);
        manager.notify(m,notification.build());
Run Code Online (Sandbox Code Playgroud)

上面的代码放置在一个名为 NotificationService 的类中,该类扩展了 Service。

我可以使用下面的代码设置颜色,

setColor(ContextCompat.getColor(this, R.color.colorAccent))
Run Code Online (Sandbox Code Playgroud)

但是使用它只能设置唯一的颜色。

**我的目标不是那样。我想用它的原始颜色设置我的图标,就像在 Dominos 中一样。

在Android Manifest中添加了以下代码,

<meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/notification_icon" />
Run Code Online (Sandbox Code Playgroud)

当我收到推送通知时,我正在启动我的服务以显示如下所示的通知, startService(new Intent(this,NotificationService.class));

但是我收到了灰色的通知图标,而不是原始颜色。还搜索了很多网站和堆栈问题。但是关于这个问题的答案是我上面提到的在Android Manifest中放置通知图标的代码。尽管我遵循了答案,但无法将通知图标设置为多米诺骨牌。我没能找到哪里出错了。搜索了大部分发布的堆栈问题。但无法为我的问题找到合适的答案。 在此处输入图片说明

任何人请帮助我...

以下是我收到的通知。

在此处输入图片说明

如您所见,我的通知图标由两个文本组成。这两个包含两种不同的颜色。这就是我正在努力实现的目标。但我只得到灰色。设置颜色只会为 h 和 m 设置一种独特的颜色。我不想要那个。

这个没有解决办法吗??没有人做到这一点??

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

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

使用PhoneGap在Android 4.4上方的Urban Airship推送通知图标

我在android中使用Urban Airship推送通知插件.一切正常,但在上面的Android 4.4推送通知图标变为白色,没有显示通知图标.此问题仅在Lolypop(> 4.4)中.任何帮助表示赞赏谢谢.

在此输入图像描述

android phonegap-pushplugin

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

世博独立应用程序:通知图标不显示显示

我有一个独立的 android 和 ios 应用程序。

目前正在android上测试推送通知。

我已经使用以下通知键设置了我的 app.json

"notification":{
      "icon": "./app_assets/icons/icon-48-gs.png",
      "color": "#000000"
    },
Run Code Online (Sandbox Code Playgroud)

上面的图标是一个具有透明度的 48x48 灰度图标。我也试过没有颜色属性。我在状态栏和实际通知中得到的只是一个白色/浅灰色/黑色方块。

仅灰色方块

在世博论坛中,我看到其他人提到他们使用 96x96 大小的图标解决了这个问题。这根本没有帮助。

https://forums.expo.io/t/push-notifications-missing-icon-on-android/9170

https://forums.expo.io/t/android-notification-status-bar-icon-too-small/7175

有人可以帮助提供有关问题可能是什么的指导吗?


根据下面@Raaj Nadar 的评论更新,这是我尝试过的图标。

在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明

react-native expo

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

Firebase通知呈灰色颤动

我正在使用Firebase Cloud Messaging将通知发送到我的Flutter应用。它工作正常,但我的应用程序图标通知在Google Pixel XL上为灰色。我可以看到轮廓,但是由于某种原因,它仍然是灰色的。我读过不同的文章,它与Android SDK级别有关,但是Flutter中的minSdkVersion已经是16(小于21),所以我不明白为什么颜色不会显示。

那么可以用颜色显示我的应用程序图标以进行通知吗?

- 提前致谢

android push-notification firebase flutter firebase-cloud-messaging

1
推荐指数
3
解决办法
2005
查看次数