Here you can find the source of getFirstInterval(Context context, long lastupdate, long updateinterval)
Parameter | Description |
---|---|
context | a parameter |
private static long getFirstInterval(Context context, long lastupdate, long updateinterval)
//package com.java2s; import android.content.Context; import android.util.Log; public class Main { public static final String TAG = "AlarmUtils"; /**//from ww w . j av a 2 s .c o m * Gets the first interval for setting an alarm. * * It is calculated using the last time of a successful update. * * @param context * @return */ private static long getFirstInterval(Context context, long lastupdate, long updateinterval) { long now = System.currentTimeMillis(); long firstinterval = lastupdate - now + updateinterval; if (firstinterval < 0) { Log.d(TAG, "Limit first interval from " + firstinterval + " to " + 0); firstinterval = 0; } else if (firstinterval > updateinterval) { Log.d(TAG, "Limit first interval from " + firstinterval + " to " + updateinterval); firstinterval = updateinterval; } return firstinterval; } }