Commit f9b82fe5 authored by Ash Connell's avatar Ash Connell
Browse files

add ability to see small icon backgound color

parent 7b3d031c
Loading
Loading
Loading
Loading
+1 −0
Changes for README.md: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ Parameter | Description
`options.android` | `JSON Object` Android specific initialization options.
`options.android.senderID` | `String` Maps to the project number in the Google Developer Console.
`options.android.icon` | `String` Optional. The name of a drawable resource to use as the small-icon. You can also override this option server-side by sending a `icon` key on the gcm data.
`options.android.iconColor` | `String` Optional. Sets the background color of the small icon. [Supported Formats](http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String))
`options.android.largeIcon` | `String` Optional. The name of a drawable resource to use as the large-icon. You can also override this option server-side by sending a `largeIcon` key on the gcm data.
`options.ios` | `JSON Object` iOS specific initialization options.
`options.windows` | `JSON Object` Windows specific initialization options.
+21 −0
Changes for src/android/com/adobe/phonegap/push/GCMIntentService.java: 21 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
@@ -106,10 +107,30 @@ public class GCMIntentService extends GCMBaseIntentService {
		
 		SharedPreferences prefs = context.getSharedPreferences("com.adobe.phonegap.push", Context.MODE_PRIVATE);
 		String localIcon = prefs.getString("icon", null);
 		String localIconColor = prefs.getString("iconColor", null);
		String localLargeIcon = prefs.getString("largeIcon", null);
 		Log.d(LOG_TAG, "stored icon=" + localIcon);
 		Log.d(LOG_TAG, "stored iconColor=" + localIconColor);
		Log.d(LOG_TAG, "stored largeIcon=" + localLargeIcon);

		/*
 		 * Notification Icon Color
 		 *
 		 * Sets the small-icon background color of the notification.
 		 * To use, add the `iconColor` key to plugin android options
 		 *
 		 */
		int iconColor = 0;
		if (localIconColor != null) {
			try {
				iconColor = Color.parseColor(localIconColor);
			} catch (IllegalArgumentException e) {
				Log.e(LOG_TAG, "couldnt parse color from android options");
			}
		}
		if (iconColor != 0) {
			mBuilder.setColor(iconColor);
		}

 		/*
 		 * Notification Icon
+5 −0
Changes for src/android/com/adobe/phonegap/push/PushPlugin.java: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -79,6 +79,11 @@ public class PushPlugin extends CordovaPlugin {
                } catch (JSONException e) {
                    Log.d(LOG_TAG, "no icon option");
                }
                try {
                    editor.putString("iconColor", jo.getString("iconColor"));
                } catch (JSONException e) {
                    Log.d(LOG_TAG, "no iconColor option");
                }
                try {
                    editor.putString("largeIcon", jo.getString("largeIcon"));
                } catch (JSONException e) {