Java Code Examples for com.eveningoutpost.dexdrip.Services.MissedReadingService#getOtherAlertReraiseSec()

The following examples show how to use com.eveningoutpost.dexdrip.Services.MissedReadingService#getOtherAlertReraiseSec() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Notifications.java    From xDrip-Experimental with GNU General Public License v3.0 5 votes vote down vote up
private long calcuatleArmTimeUnclearalert(Context ctx, long now, boolean unclearAlert) {
    if (!unclearAlert) {
        return Long.MAX_VALUE;
    }
    Long wakeTimeUnclear = Long.MAX_VALUE;

    UserNotification userNotification = UserNotification.GetNotificationByType("bg_unclear_readings_alert");
    if (userNotification == null) {
        // An alert should have already being played, how is this NULL.
    	Log.wtf(TAG, "No active alert exists.");
        wakeTimeUnclear = now + MissedReadingService.getOtherAlertReraiseSec(ctx) * 1000;
    } else {
        // This alert is snoozed
        // reminder - userNotification.timestamp is the time that the alert should be played again
        wakeTimeUnclear = (long)userNotification.timestamp;
    }
    
    if(wakeTimeUnclear < now ) {
        // we should alert now,
        wakeTimeUnclear = now;
    }
    if( wakeTimeUnclear == Long.MAX_VALUE) {
        // Should not happen
        Log.e(TAG ,"calcuatleArmTimeUnclearalert wakeTimeUnclear bad value setting it to one minute from now " + new Date(wakeTimeUnclear) + " in " +  ((wakeTimeUnclear - now)/60000d) + " minutes" );
        return now + 60 * 1000;
    }
    Log.w(TAG ,"calcuatleArmTimeUnclearalert returning " + new Date(wakeTimeUnclear) + " in " +  ((wakeTimeUnclear - now)/60000d) + " minutes" );
    return wakeTimeUnclear;
}
 
Example 2
Source File: Notifications.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
public static void bgUnclearAlert(Context context) {
    long otherAlertReraiseSec = MissedReadingService.getOtherAlertReraiseSec(context, "bg_unclear_readings_alert");
    OtherAlert(context, "bg_unclear_readings_alert", "Unclear Sensor Readings" + "  (@" + JoH.hourMinuteString() + ")", uncleanAlertNotificationId, NotificationChannels.BG_ALERT_CHANNEL, true, otherAlertReraiseSec);
}
 
Example 3
Source File: Notifications.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
public static void bgMissedAlert(Context context) {
    long otherAlertReraiseSec = MissedReadingService.getOtherAlertReraiseSec(context, "bg_missed_alerts");
    OtherAlert(context, "bg_missed_alerts", context.getString(R.string.bg_reading_missed) + "  (@" + JoH.hourMinuteString() + ")", missedAlertNotificationId, NotificationChannels.BG_MISSED_ALERT_CHANNEL, true, otherAlertReraiseSec);
}
 
Example 4
Source File: Notifications.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public static void bgUnclearAlert(Context context) {
    long otherAlertReraiseSec = MissedReadingService.getOtherAlertReraiseSec(context, "bg_unclear_readings_alert");
    OtherAlert(context, "bg_unclear_readings_alert", "Unclear Sensor Readings" + "  (@" + JoH.hourMinuteString() + ")", uncleanAlertNotificationId, NotificationChannels.BG_ALERT_CHANNEL, true, otherAlertReraiseSec);
}
 
Example 5
Source File: Notifications.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public static void bgMissedAlert(Context context) {
    long otherAlertReraiseSec = MissedReadingService.getOtherAlertReraiseSec(context, "bg_missed_alerts");
    OtherAlert(context, "bg_missed_alerts", context.getString(R.string.bg_reading_missed) + "  (@" + JoH.hourMinuteString() + ")", missedAlertNotificationId, NotificationChannels.BG_MISSED_ALERT_CHANNEL, true, otherAlertReraiseSec);
}
 
Example 6
Source File: Notifications.java    From xDrip-Experimental with GNU General Public License v3.0 4 votes vote down vote up
public static void bgUnclearAlert(Context context) {
    long otherAlertReraiseSec = MissedReadingService.getOtherAlertReraiseSec(context);
    String message = dateFormat.format(new Date()) + ": Unclear Sensor Readings";
    OtherAlert(context, "bg_unclear_readings_alert", message, uncleanAlertNotificationId,  otherAlertReraiseSec);
}
 
Example 7
Source File: Notifications.java    From xDrip-Experimental with GNU General Public License v3.0 4 votes vote down vote up
public static void bgMissedAlert(Context context) {
    long otherAlertReraiseSec = MissedReadingService.getOtherAlertReraiseSec(context);
    String message = "BG Readings Missed (" + dateFormat.format(new Date()) + ")";
    OtherAlert(context, "bg_missed_alerts", message, missedAlertNotificationId, otherAlertReraiseSec);
}