urbanairship-core/src/main/java/com/urbanairship/automation/AutomationEngine.java
public PendingResult<T> schedule(@NonNull final ScheduleInfo scheduleInfo) {
        final PendingResult<T> pendingResult = new PendingResult<>();

        backgroundHandler.post(new Runnable() {
            @Override
            public void run() {
                cleanSchedules();

                if (dataManager.getScheduleCount() >= scheduleLimit) {
                    Logger.error("AutomationEngine - Unable to insert schedule due to schedule exceeded limit.");
                    pendingResult.setResult(null);
                    return;
                }

                String scheduleId = UUID.randomUUID().toString();
                ScheduleEntry entry = new ScheduleEntry(scheduleId, scheduleInfo);

                List<ScheduleEntry> entries = Collections.singletonList(entry);
                dataManager.saveSchedules(entries);
                subscribeStateObservables(entries);

                List<T> result = convertEntries(entries);
                Logger.verbose("AutomationEngine - Scheduled entries: " + result);
                pendingResult.setResult(result.size() > 0 ? result.get(0) : null);
            }
        });

        return pendingResult;
    }
/**
     * Schedules a single action schedule.
     *
     * @param scheduleInfo The {@link ScheduleInfo} instance.
     * @return A pending result.
     */
Schedules a single action schedule.
@param scheduleInfo The  ScheduleInfo instance.
@return A pending result.
Schedules a single action schedule . @param scheduleInfo The ScheduleInfo instance . @return A pending result .
public PendingResult<T> schedule(@NonNull final ScheduleInfo scheduleInfo) {
        final PendingResult<T> pendingResult = new PendingResult<>();
        backgroundHandler.post(new Runnable() {
            @Override
            public void run() {
                cleanSchedules();
                if (dataManager.getScheduleCount() >= scheduleLimit) {
                    Logger.error("AutomationEngine - Unable to insert schedule due to schedule exceeded limit.");
                    pendingResult.setResult(null);
                    return;
                }
                String scheduleId = UUID.randomUUID().toString();
                ScheduleEntry entry = new ScheduleEntry(scheduleId, scheduleInfo);
                List<ScheduleEntry> entries = Collections.singletonList(entry);
                dataManager.saveSchedules(entries);
                subscribeStateObservables(entries);
                List<T> result = convertEntries(entries);
                Logger.verbose("AutomationEngine - Scheduled entries: " + result);
                pendingResult.setResult(result.size() > 0 ? result.get(0) : null);
            }
        });
        return pendingResult;
    }
public PendingResult < T > schedule ( @ NonNull final ScheduleInfo scheduleInfo ) { final PendingResult < T > pendingResult = new PendingResult < > ( ) ; backgroundHandler . post ( new Runnable ( ) { @ Override public void run ( ) { cleanSchedules ( ) ; if ( dataManager . getScheduleCount ( ) >= scheduleLimit ) { Logger . error ( "AutomationEngine - Unable to insert schedule due to schedule exceeded limit." ) ; pendingResult . setResult ( null ) ; return ; } String scheduleId = UUID . randomUUID ( ) . toString ( ) ; ScheduleEntry entry = new ScheduleEntry ( scheduleId , scheduleInfo ) ; List < ScheduleEntry > entries = Collections . singletonList ( entry ) ; dataManager . saveSchedules ( entries ) ; subscribeStateObservables ( entries ) ; List < T > result = convertEntries ( entries ) ; Logger . verbose ( "AutomationEngine - Scheduled entries: " + result ) ; pendingResult . setResult ( result . size ( ) > 0 ? result . get ( 0 ) : null ) ; } } ) ; return pendingResult ; }
Schedules a single action schedule.
Schedules a single action schedule .