Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Commit 5c6446d

Browse files
committed
📝 Issue #2487: Custom notification icon for android + documentation
1 parent e056943 commit 5c6446d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/PAYLOAD.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,16 @@ const push = PushNotification.init({
400400
```
401401

402402
Where _icon_ is the name of an `.png` image file in the Android `res/drawable` folder. For example: `platforms/android/res/drawable/phonegap.png`
403-
Writing a hook to describe how to copy an image to the Android `res/drawable` folder is out of scope for this README but there is an [excellent tutorial](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) that you can copy.
403+
404+
You can use a `resource-file` tag to copy the image to the `res/drawable` folder like this:
405+
406+
```xml
407+
<resource-file src="res/icon/android/push/drawable-mdpi/icon.png" target="app/src/main/res/drawable-mdpi/icon.png" />
408+
<resource-file src="res/icon/android/push/drawable-hdpi/icon.png" target="app/src/main/res/drawable-hdpi/icon.png" />
409+
<resource-file src="res/icon/android/push/drawable-xhdpi/icon.png" target="app/src/main/res/drawable-xhdpi/icon.png" />
410+
<resource-file src="res/icon/android/push/drawable-xxhdpi/icon.png" target="app/src/main/res/drawable-xxhdpi/icon.png" />
411+
<resource-file src="res/icon/android/push/drawable-xxxhdpi/icon.png" target="app/src/main/res/drawable-xxxhdpi/icon.png" />
412+
```
404413

405414
`iconColor` is one of the supported formats #RRGGBB or #AARRGGBB or one of the following names: 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', 'yellow', 'lightgray', 'darkgray', 'grey', 'lightgrey', 'darkgrey', 'aqua', 'fuchsia', 'lime', 'maroon', 'navy', 'olive', 'purple', 'silver', 'teal'. `iconColor` is supported on Android 5.0 and greater.
406415

@@ -455,6 +464,16 @@ Would look for the _twitter_ image in the `res/drawable` folder and produce the
455464

456465
![2015-07-24 02 34 41](https://cloud.githubusercontent.com/assets/353180/8866903/2df48028-3190-11e5-8176-fe8b3f7c5aab.png)
457466

467+
Again you can use a `resource-file` tag to copy the image to the `res/drawable` folder like this:
468+
469+
```xml
470+
<resource-file src="res/icon/android/push/drawable-mdpi/twitter.png" target="app/src/main/res/drawable-mdpi/twitter.png" />
471+
<resource-file src="res/icon/android/push/drawable-hdpi/twitter.png" target="app/src/main/res/drawable-hdpi/twitter.png" />
472+
<resource-file src="res/icon/android/push/drawable-xhdpi/twitter.png" target="app/src/main/res/drawable-xhdpi/twitter.png" />
473+
<resource-file src="res/icon/android/push/drawable-xxhdpi/twitter.png" target="app/src/main/res/drawable-xxhdpi/twitter.png" />
474+
<resource-file src="res/icon/android/push/drawable-xxxhdpi/twitter.png" target="app/src/main/res/drawable-xxxhdpi/twitter.png" />
475+
```
476+
458477
The second is the _assets_ folder in your app. This JSON sent from FCM:
459478

460479
```json

0 commit comments

Comments
 (0)