public void onPause() {
   Localytics.dismissCurrentInAppMessage();
   Localytics.clearInAppMessageDisplayActivity();
   Localytics.closeSession();
   Localytics.upload();
   super.onPause();
 }
 public void onResume() {
   super.onResume();
   Localytics.openSession();
   Localytics.setInAppMessageDisplayActivity(this);
   Localytics.handlePushNotificationOpened(getIntent());
   Localytics.handleTestMode(getIntent());
   Localytics.upload();
 }