private void Vibrate(Context ctx, AlertType alert, String bgValue, Boolean overrideSilent, int timeFromStartPlaying) {
String title = bgValue + " " + alert.name;
String content = "BG LEVEL ALERT: " + bgValue + " (@" + JoH.hourMinuteString() + ")";
Intent intent = new Intent(ctx, SnoozeActivity.class);
boolean localOnly = (Home.get_forced_wear() && Pref.getBooleanDefaultFalse("bg_notifications"));
Log.d(TAG, "NotificationCompat.Builder localOnly=" + localOnly);
NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(title)
.setContentText(content)
.setContentIntent(notificationIntent(ctx, intent))
.setLocalOnly(localOnly)
.setDeleteIntent(snoozeIntent(ctx));
builder.setVibrate(Notifications.vibratePattern);
Log.ueh("Alerting",content);
NotificationManager mNotifyMgr = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
mNotifyMgr.notify(Notifications.exportAlertNotificationId, builder.build());
if (Pref.getBooleanDefaultFalse("alert_use_sounds")) {
try {
if (JoH.ratelimit("wear-alert-sound", 10)) {
JoH.playResourceAudio(R.raw.warning);
}
} catch (Exception e) {
}
}
}