示例#1
0
  /**
   * This method should be called whenever any activity resumes. It assists in tracking user session
   * data in the Amazon Mobile Analytics system.
   */
  public void handleOnResume() {
    SessionClient sessionClient = null;

    try {
      if (mobileAnalyticsManager != null
          && (sessionClient = mobileAnalyticsManager.getSessionClient()) != null) {
        sessionClient.resumeSession();
      }
    } catch (final Exception e) {
      Log.w(LOG_TAG, "Unable to resume analytics. " + e.getMessage(), e);
    }
  }
示例#2
0
  /**
   * This method should be invoked when each activity is paused. It is used to assist in tracking
   * user session data in Amazon Mobile Analytics system.
   */
  public void handleOnPause() {

    SessionClient sessionClient = null;
    EventClient eventClient = null;

    try {
      if (mobileAnalyticsManager != null
          && (sessionClient = mobileAnalyticsManager.getSessionClient()) != null
          && (eventClient = mobileAnalyticsManager.getEventClient()) != null) {
        sessionClient.pauseSession();
        eventClient.submitEvents();
      }
    } catch (final Exception e) {
      Log.w(LOG_TAG, "Unable to report analytics. " + e.getMessage(), e);
    }
  }