From 2a32624d9dada54c959eb46e5349f37a021d39b1 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 1 Mar 2017 19:58:53 -0600 Subject: [PATCH] feat(local-notifications): support for icon background color (#1079) The Cordova plugin Ionic Natives uses allows specifying the background color of the smallIcon. By not including it in your interface you force users to use the default color for their version of Android. While the LocalNotification plugin is not well documented, it does include this feature, see Options.java line 253: ``` /** * @return * The notification background color for the small icon * Returns null, if no color is given. */ public int getColor() { String hex = options.optString("color", null); if (hex == null) { return NotificationCompat.COLOR_DEFAULT; } int aRGB = Integer.parseInt(hex, 16); return aRGB + 0xFF000000; } ``` I've simply added the option to the interface as well as a short description. This lets you go from the default color (varies by Android version): https://goo.gl/photos/nERcj4GZgapy8aee9 To any color you'd like: https://goo.gl/photos/t8V9WVba8jDU49aHA And also works if you also specify a large icon: https://goo.gl/photos/gWQYwa12djmdXfYcA --- src/plugins/localnotifications.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index d09c847405..cbece790e4 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -64,6 +64,13 @@ export interface ILocalNotification { * Default: res://ic_popup_reminder */ smallIcon?: string; + + /** + * ANDROID ONLY + * RGB value for the background color of the smallIcon. + * Default: Androids COLOR_DEFAULT, which will vary based on Android version. + */ + color?: string; /**