public Builder SetDefaults(NotificationDefaults defaults) { Notification.Defaults = defaults; if ((defaults & NotificationDefaults.Lights) != 0) { Notification.Flags |= NotificationFlags.ShowLights; } return(this); }
public frmEMM() { InitializeComponent(); bw.WorkerReportsProgress = true; bw.WorkerSupportsCancellation = true; bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); dgvCMCampaign.AutoGenerateColumns = false; dgvUSUsers.AutoGenerateColumns = false; NotificationDefaults.CheckInternet(); notify = new Notification(); //Load default page NotificationDefaults.SetTabPreferences(out notify, tbHomeUsersGroups, tabMetro); //checkHTMLorPlain(); }
public Builder SetDefaults(NotificationDefaults defaults) { Notification.Defaults = defaults; if ((defaults & NotificationDefaults.Lights) != 0) { Notification.Flags |= NotificationFlags.ShowLights; } return this; }
static public void NotifyCommon(Context context, int id, bool replace, string tickerText, String title, String text, int icon, Intent notificationIntent, bool showLed, Uri soundUri, bool vibration, Uri contentUri) { PendingIntentFlags flags = 0; if (replace) { flags = PendingIntentFlags.CancelCurrent; } PendingIntent contentIntent = PendingIntent.GetActivity(context, id, notificationIntent, flags); NotificationDefaults defaults = 0; // If vibration was requested, use the system-default vibration pattern defaults = (vibration) ? NotificationDefaults.Vibrate : 0; // If notification light was requested, use system-default colour and blink pattern defaults |= (showLed) ? NotificationDefaults.Lights : 0; Notification.Builder notificationBuilder = new Notification.Builder(context) .SetDefaults(defaults) .SetSound(soundUri) .SetContentTitle(title) .SetTicker(tickerText) .SetContentText(text) .SetContentIntent(contentIntent) .SetSmallIcon(icon, 0) .SetAutoCancel(true); // No notification light if not requested if (!showLed) { notificationBuilder.SetLights(0, 0, 0); } // No vibration pattern if not requested if (!vibration) { notificationBuilder.SetVibrate(new long[] { 0, 0 }); } Notification notification = null; if (contentUri != null) { try { Notification.BigPictureStyle picBuilder = new Notification.BigPictureStyle(notificationBuilder) .BigPicture(MediaStore.Images.Media.GetBitmap(context.ContentResolver, contentUri)); notification = picBuilder.Build(); } catch (Exception e) { Log.Error(LogTag, "Unable to decode incoming image for big notification: " + e); } } if (notification == null) { notification = notificationBuilder.Build(); } NotificationManager notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService); notificationManager.Notify(id, notification); Log.Warn(LogTag, title + ":" + text); }