Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: services/notifications/src/org/chromium/mojo/notifications/NotificationBuilder.java

Issue 1476823003: Fix notifications. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/notifications/interfaces/notifications.mojom ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/notifications/src/org/chromium/mojo/notifications/NotificationBuilder.java
diff --git a/services/notifications/src/org/chromium/mojo/notifications/NotificationBuilder.java b/services/notifications/src/org/chromium/mojo/notifications/NotificationBuilder.java
index 3203106332673c83d9960fbec7784423e78cc797..c970e2f807ca5a1c834e13aa479dbdd081e782b6 100644
--- a/services/notifications/src/org/chromium/mojo/notifications/NotificationBuilder.java
+++ b/services/notifications/src/org/chromium/mojo/notifications/NotificationBuilder.java
@@ -8,6 +8,8 @@ import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
+import android.media.RingtoneManager;
+import android.net.Uri;
import android.os.Parcel;
import org.chromium.mojo.intent.IntentReceiver;
@@ -53,6 +55,18 @@ class NotificationBuilder {
notificationBuilder.setContentText(notificationData.text);
notificationBuilder.setSmallIcon(mNotificationIconResourceId);
notificationBuilder.setAutoCancel(true);
+ if (notificationData.playSound) {
+ Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
+ notificationBuilder.setSound(alarmSound);
+ }
+ if (notificationData.vibrate) {
+ long[] vibratePattern = {500, 500, 500, 500, 500, 500, 500, 500, 500};
+ notificationBuilder.setVibrate(vibratePattern);
+ }
+ if (notificationData.setLights) {
+ notificationBuilder.setLights(Notification.COLOR_DEFAULT, 500, 500);
+ }
+
populatePendingIntent(Action.SELECT, notificationId, notificationBuilder);
}
« no previous file with comments | « mojo/services/notifications/interfaces/notifications.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698