sdk/src/main/java/com/bugsnag/android/SessionTracker.java
private void trackSessionIfNeeded(final Session session) {
        boolean notifyForRelease = configuration.shouldNotifyForReleaseStage(getReleaseStage());

        if (notifyForRelease
            && (configuration.shouldAutoCaptureSessions() || !session.isAutoCaptured())
            && session.isTracked().compareAndSet(false, true)) {
            try {
                final String endpoint = configuration.getSessionEndpoint();
                Async.run(new Runnable() {
                    @Override
                    public void run() {
                        //FUTURE:SM It would be good to optimise this
                        flushStoredSessions();

                        SessionTrackingPayload payload =
                            new SessionTrackingPayload(session, null,
                                client.appData, client.deviceData);

                        try {
                            configuration.getDelivery().deliver(payload, configuration);
                        } catch (DeliveryFailureException exception) { // store for later sending
                            Logger.warn("Storing session payload for future delivery", exception);
                            sessionStore.write(session);
                        } catch (Exception exception) {
                            Logger.warn("Dropping invalid session tracking payload", exception);
                        }
                    }
                });
            } catch (RejectedExecutionException exception) {
                // This is on the current thread but there isn't much else we can do
                sessionStore.write(session);
            }
        }
    }
/**
     * Determines whether or not a session should be tracked. If this is true, the session will be
     * stored and sent to the Bugsnag API, otherwise no action will occur in this method.
     *
     * @param session the session
     */
Determines whether or not a session should be tracked. If this is true, the session will be
stored and sent to the Bugsnag API, otherwise no action will occur in this method.

@param session the session
Determines whether or not a session should be tracked . If this is true the session will be stored and sent to the Bugsnag API otherwise no action will occur in this method . @param session the session
private void trackSessionIfNeeded(final Session session) {
        boolean notifyForRelease = configuration.shouldNotifyForReleaseStage(getReleaseStage());
        if (notifyForRelease
            && (configuration.shouldAutoCaptureSessions() || !session.isAutoCaptured())
            && session.isTracked().compareAndSet(false, true)) {
            try {
                final String endpoint = configuration.getSessionEndpoint();
                Async.run(new Runnable() {
                    @Override
                    public void run() {
                        flushStoredSessions();
                        SessionTrackingPayload payload =
                            new SessionTrackingPayload(session, null,
                                client.appData, client.deviceData);
                        try {
                            configuration.getDelivery().deliver(payload, configuration);
                        } catch (DeliveryFailureException exception) { 
                            Logger.warn("Storing session payload for future delivery", exception);
                            sessionStore.write(session);
                        } catch (Exception exception) {
                            Logger.warn("Dropping invalid session tracking payload", exception);
                        }
                    }
                });
            } catch (RejectedExecutionException exception) {
                sessionStore.write(session);
            }
        }
    }
private void trackSessionIfNeeded ( final Session session ) { boolean notifyForRelease = configuration . shouldNotifyForReleaseStage ( getReleaseStage ( ) ) ; if ( notifyForRelease && ( configuration . shouldAutoCaptureSessions ( ) || ! session . isAutoCaptured ( ) ) && session . isTracked ( ) . compareAndSet ( false , true ) ) { try { final String endpoint = configuration . getSessionEndpoint ( ) ; Async . run ( new Runnable ( ) { @ Override public void run ( ) { flushStoredSessions ( ) ; SessionTrackingPayload payload = new SessionTrackingPayload ( session , null , client . appData , client . deviceData ) ; try { configuration . getDelivery ( ) . deliver ( payload , configuration ) ; } catch ( DeliveryFailureException exception ) { Logger . warn ( "Storing session payload for future delivery" , exception ) ; sessionStore . write ( session ) ; } catch ( Exception exception ) { Logger . warn ( "Dropping invalid session tracking payload" , exception ) ; } } } ) ; } catch ( RejectedExecutionException exception ) { sessionStore . write ( session ) ; } } }
Determines whether or not a session should be tracked.
Determines whether or not a session should be tracked .
//FUTURE:SM It would be good to optimise this // store for later sending // This is on the current thread but there isn't much else we can do