urbanairship-core/src/main/java/com/urbanairship/analytics/Analytics.java
void onForeground(long timeMS) {
        // Start a new environment when the app enters the foreground
        sessionId = UUID.randomUUID().toString();
        Logger.debug("Analytics - New session: " + sessionId);

        // If the app backgrounded, there should be no current screen
        if (currentScreen == null) {
            trackScreen(previousScreen);
        }

        // If advertising ID tracking is enabled, dispatch a job to update the advertising ID.
        if (isAutoTrackAdvertisingIdEnabled()) {
            jobDispatcher.dispatch(JobInfo.newBuilder()
                                          .setAction(ACTION_UPDATE_ADVERTISING_ID)
                                          .setId(JobInfo.ANALYTICS_UPDATE_ADVERTISING_ID)
                                          .setAirshipComponent(Analytics.class)
                                          .build());
        }

        addEvent(new AppForegroundEvent(timeMS));
    }
/**
     * Called when the app is foregrounded.
     *
     * @param timeMS Time of foregrounding.
     */
Called when the app is foregrounded.
@param timeMS Time of foregrounding.
Called when the app is foregrounded . @param timeMS Time of foregrounding .
void onForeground(long timeMS) {
        sessionId = UUID.randomUUID().toString();
        Logger.debug("Analytics - New session: " + sessionId);
        if (currentScreen == null) {
            trackScreen(previousScreen);
        }
        if (isAutoTrackAdvertisingIdEnabled()) {
            jobDispatcher.dispatch(JobInfo.newBuilder()
                                          .setAction(ACTION_UPDATE_ADVERTISING_ID)
                                          .setId(JobInfo.ANALYTICS_UPDATE_ADVERTISING_ID)
                                          .setAirshipComponent(Analytics.class)
                                          .build());
        }
        addEvent(new AppForegroundEvent(timeMS));
    }
void onForeground ( long timeMS ) { sessionId = UUID . randomUUID ( ) . toString ( ) ; Logger . debug ( "Analytics - New session: " + sessionId ) ; if ( currentScreen == null ) { trackScreen ( previousScreen ) ; } if ( isAutoTrackAdvertisingIdEnabled ( ) ) { jobDispatcher . dispatch ( JobInfo . newBuilder ( ) . setAction ( ACTION_UPDATE_ADVERTISING_ID ) . setId ( JobInfo . ANALYTICS_UPDATE_ADVERTISING_ID ) . setAirshipComponent ( Analytics . class ) . build ( ) ) ; } addEvent ( new AppForegroundEvent ( timeMS ) ) ; }
Called when the app is foregrounded.
Called when the app is foregrounded .
// Start a new environment when the app enters the foreground // If the app backgrounded, there should be no current screen // If advertising ID tracking is enabled, dispatch a job to update the advertising ID.