I am having trouble setting the notification icon on android studio.
I set up the drawable folder like so:
And I've also set the default icon in my AndroidManifest.xml file:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
And here I'm setting the icon field to notification_icon
: https://developers.google.com/cloud-messaging/http-server-ref#downstream-http-messages-json (p.s. I'm aware that's GCM, but it works. I'm receiving the notification with everything besides the icon)
What am I missing? All I see is a white square inside a grey circle.
This is my backend code: Pushex.push(%{title: user.name, body: "message goes here", badge: 1, sound: "default", icon: "notification_icon"}, to: user.fcm_token, using: :gcm)
(https://github.com/tuvistavie/pushex)
With SDK 9.8.0 however, you can override the default! In your AndroidManifest.xml you can set the following fields to customise the icon and color:
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/notification_icon" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/google_blue" />
and
<manifest>
<application
android:icon="@drawable/icon"
android:label="@string/app_name">
<!-- Add your meta-data here-->
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With