Skip to content

Commit 1b3d5ec

Browse files
kroikieGerrit Code Review
authored andcommitted
Merge "Update sample docs for custom default icon"
2 parents e613a70 + 66547d1 commit 1b3d5ec

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

messaging/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,27 @@ Use Firebase console to send FCM messages to device or emulator.
4848
message printed in the logs. If it is in the background, a system notification should be
4949
displayed. When the notification is tapped, the application should return to the quickstart application.
5050

51+
Best Practices
52+
--------------
53+
54+
## Customize default notification
55+
56+
### Custom default icon
57+
58+
Setting a custom default icon allows you to specify what icon is used for notification
59+
messages if no icon is set in the notification payload. Also use the custom default
60+
icon to set the icon used by notification messages sent from the Firebase console.
61+
If no custom default icon is set and no icon is set in the notification payload,
62+
the application icon (rendered in white) is used.
63+
64+
### Custom default Color
65+
66+
You can also define what color is used with your notification. Different android
67+
versions use this settings in different ways: Android < N use this as background color
68+
for the icon. Android >= N use this to color the icon and the app name.
69+
70+
See the [docs](https://goo.gl/sPggnS) for more.
71+
5172
Result
5273
-----------
5374
<img src="app/src/screen.png" height="534" width="300"/>

messaging/app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
android:label="@string/app_name"
99
android:theme="@style/AppTheme">
1010
<!-- [START fcm_default_icon] -->
11+
<!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
12+
See README(https://goo.gl/l4GJaQ) for more. -->
1113
<meta-data
1214
android:name="com.google.firebase.messaging.default_notification_icon"
1315
android:resource="@drawable/ic_stat_ic_notification" />
16+
<!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
17+
notification message. See README(https://goo.gl/6BKBk7) for more. -->
1418
<meta-data
1519
android:name="com.google.firebase.messaging.default_notification_color"
1620
android:resource="@color/colorAccent" />

0 commit comments

Comments
 (0)