diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-10-22 16:10:59 -0400 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-10-22 16:10:59 -0400 |
| commit | e13e1485ba30387e689a0d4511f8385cbba83a50 (patch) | |
| tree | dfcd4ba5a6162db6a52a883fd038f370c99815ca /plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/GCMIntentService.java | |
| parent | 3657075f70652b2d84c5f6cb047dc600ceaeae20 (diff) | |
modified GCM file to make sure my custo sound works
Diffstat (limited to 'plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/GCMIntentService.java')
| -rw-r--r-- | plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/GCMIntentService.java | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/GCMIntentService.java b/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/GCMIntentService.java index b22712d0..67230c22 100644 --- a/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/GCMIntentService.java +++ b/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/GCMIntentService.java @@ -133,11 +133,13 @@ public class GCMIntentService extends GCMBaseIntentService implements PushConsta String localIcon = prefs.getString(ICON, null); String localIconColor = prefs.getString(ICON_COLOR, null); boolean soundOption = prefs.getBoolean(SOUND, true); - boolean vibrateOption = prefs.getBoolean(VIBRATE, true); + //PP - make vibrate false + //boolean vibrateOption = prefs.getBoolean(VIBRATE, true); + boolean vibrateOption = false; Log.d(LOG_TAG, "stored icon=" + localIcon); Log.d(LOG_TAG, "stored iconColor=" + localIconColor); Log.d(LOG_TAG, "stored sound=" + soundOption); - Log.d(LOG_TAG, "stored vibrate=" + vibrateOption); + Log.d(LOG_TAG, "stored vibrate=" + vibrateOption); /* * Notification Vibration @@ -166,7 +168,7 @@ public class GCMIntentService extends GCMBaseIntentService implements PushConsta * If no resource is found, falls * */ - setNotificationSmallIcon(context, extras, packageName, resources, mBuilder, localIcon); + setNotificationSmallIcon(context, extras, packageName, resources, mBuilder, localIcon); /* * Notification Large-Icon @@ -180,19 +182,19 @@ public class GCMIntentService extends GCMBaseIntentService implements PushConsta * - if none, we don't set the large icon * */ - setNotificationLargeIcon(extras, packageName, resources, mBuilder); + setNotificationLargeIcon(extras, packageName, resources, mBuilder); /* * Notification Sound */ if (soundOption) { - setNotificationSound(context, extras, mBuilder); + // setNotificationSound(context, extras, mBuilder); } /* * LED Notification */ - setNotificationLedColor(extras, mBuilder); + setNotificationLedColor(extras, mBuilder); /* * Priority Notification @@ -214,8 +216,18 @@ public class GCMIntentService extends GCMBaseIntentService implements PushConsta */ createActions(extras, mBuilder, resources, packageName); - mNotificationManager.notify(appName, notId, mBuilder.build()); - } + // PP add lights + mBuilder.setLights(0xFFFF0000, 500, 500); + + //PP - http://stackoverflow.com/questions/29343974/custom-sound-in-android-push-notifications-gcm + // mNotificationManager.notify(appName, notId, mBuilder.build()); + Notification notification = mBuilder.build(); + //notification.sound = Uri.parse("android.resource://" + context.getPackageName() + "/"+ R.raw.blop); + //PP http://stackoverflow.com/questions/15449945/notification-sound-from-uri-parse-does-not-work + notification.sound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + getPackageName() + "/raw/blop"); + //notification.defaults |= Notification.DEFAULT_VIBRATE; + mNotificationManager.notify((String) appName, notId, notification); + } private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, Resources resources, String packageName) { Log.d(LOG_TAG, "create actions"); |
