private void Vibrate(Context ctx, AlertType alert, String bgValue, Boolean overrideSilent, int timeFromStartPlaying) { //KS Watch currently only supports Vibration, no audio; Use VibrateAudio to support audio 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"));//KS Log.d(TAG, "NotificationCompat.Builder localOnly=" + localOnly); NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx)//KS Notification .setSmallIcon(R.drawable.ic_launcher)//KS ic_action_communication_invert_colors_on .setContentTitle(title) .setContentText(content) .setContentIntent(notificationIntent(ctx, intent)) .setLocalOnly(localOnly)//KS .setDeleteIntent(snoozeIntent(ctx)); builder.setVibrate(Notifications.vibratePattern); Log.ueh("Alerting",content); NotificationManager mNotifyMgr = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE); //mNotifyMgr.cancel(Notifications.exportAlertNotificationId); // this appears to confuse android wear version 2.0.0.141773014.gms even though it shouldn't - can we survive without this? 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) { // } } }
.setContentIntent(notificationIntent(ctx, intent))
.setContentTitle(title) .setContentText(content) .setContentIntent(notificationIntent(context, intent)) .setLocalOnly(localOnly) .setPriority(Pref.getBooleanDefaultFalse("high_priority_notifications") ? Notification.PRIORITY_MAX : Notification.PRIORITY_HIGH)
.setContentTitle(title) .setContentText(content) .setContentIntent(notificationIntent(context, intent)) .setLocalOnly(localOnly) .setPriority(Pref.getBooleanDefaultFalse("high_priority_notifications") ? Notification.PRIORITY_MAX : Notification.PRIORITY_HIGH)