urbanairship-core/src/main/java/com/urbanairship/analytics/data/EventManager.java
public void scheduleEventUpload(final long delay, TimeUnit timeUnit) {
        long milliseconds = timeUnit.toMillis(delay);
        Logger.verbose("EventManager - Requesting to schedule event upload with delay " + milliseconds + "ms.");

        long sendTime = System.currentTimeMillis() + milliseconds;
        long previousScheduledTime = preferenceDataStore.getLong(SCHEDULED_SEND_TIME, 0);

        // If its currently scheduled at an earlier time then skip rescheduling
        if (isScheduled) {
            if (previousScheduledTime <= sendTime && previousScheduledTime >= System.currentTimeMillis()) {
                Logger.verbose("EventManager - Event upload already scheduled for an earlier time.");
                return;
            }
        }

        Logger.verbose("EventManager - Scheduling upload in " + milliseconds + "ms.");
        JobInfo jobInfo = JobInfo.newBuilder()
                                 .setAction(jobAction)
                                 .setId(JobInfo.ANALYTICS_EVENT_UPLOAD)
                                 .setNetworkAccessRequired(true)
                                 .setAirshipComponent(Analytics.class)
                                 .setInitialDelay(milliseconds, TimeUnit.MILLISECONDS)
                                 .build();

        jobDispatcher.dispatch(jobInfo);

        preferenceDataStore.put(SCHEDULED_SEND_TIME, sendTime);
        isScheduled = true;
    }
/**
     * Schedule a batch event upload at a given time in the future.
     *
     * @param delay The initial delay.
     * @param timeUnit The time unit of the delay.
     */
Schedule a batch event upload at a given time in the future.
@param delay The initial delay.
@param timeUnit The time unit of the delay.
Schedule a batch event upload at a given time in the future . @param delay The initial delay . @param timeUnit The time unit of the delay .
public void scheduleEventUpload(final long delay, TimeUnit timeUnit) {
        long milliseconds = timeUnit.toMillis(delay);
        Logger.verbose("EventManager - Requesting to schedule event upload with delay " + milliseconds + "ms.");
        long sendTime = System.currentTimeMillis() + milliseconds;
        long previousScheduledTime = preferenceDataStore.getLong(SCHEDULED_SEND_TIME, 0);
        if (isScheduled) {
            if (previousScheduledTime <= sendTime && previousScheduledTime >= System.currentTimeMillis()) {
                Logger.verbose("EventManager - Event upload already scheduled for an earlier time.");
                return;
            }
        }
        Logger.verbose("EventManager - Scheduling upload in " + milliseconds + "ms.");
        JobInfo jobInfo = JobInfo.newBuilder()
                                 .setAction(jobAction)
                                 .setId(JobInfo.ANALYTICS_EVENT_UPLOAD)
                                 .setNetworkAccessRequired(true)
                                 .setAirshipComponent(Analytics.class)
                                 .setInitialDelay(milliseconds, TimeUnit.MILLISECONDS)
                                 .build();
        jobDispatcher.dispatch(jobInfo);
        preferenceDataStore.put(SCHEDULED_SEND_TIME, sendTime);
        isScheduled = true;
    }
public void scheduleEventUpload ( final long delay , TimeUnit timeUnit ) { long milliseconds = timeUnit . toMillis ( delay ) ; Logger . verbose ( "EventManager - Requesting to schedule event upload with delay " + milliseconds + "ms." ) ; long sendTime = System . currentTimeMillis ( ) + milliseconds ; long previousScheduledTime = preferenceDataStore . getLong ( SCHEDULED_SEND_TIME , 0 ) ; if ( isScheduled ) { if ( previousScheduledTime <= sendTime && previousScheduledTime >= System . currentTimeMillis ( ) ) { Logger . verbose ( "EventManager - Event upload already scheduled for an earlier time." ) ; return ; } } Logger . verbose ( "EventManager - Scheduling upload in " + milliseconds + "ms." ) ; JobInfo jobInfo = JobInfo . newBuilder ( ) . setAction ( jobAction ) . setId ( JobInfo . ANALYTICS_EVENT_UPLOAD ) . setNetworkAccessRequired ( true ) . setAirshipComponent ( Analytics . class ) . setInitialDelay ( milliseconds , TimeUnit . MILLISECONDS ) . build ( ) ; jobDispatcher . dispatch ( jobInfo ) ; preferenceDataStore . put ( SCHEDULED_SEND_TIME , sendTime ) ; isScheduled = true ; }
Schedule a batch event upload at a given time in the future.
Schedule a batch event upload at a given time in the future .
// If its currently scheduled at an earlier time then skip rescheduling