code: private void handleOnResume(Context context) {
  
          if (wasInBackground.get()) {
              startTime.set(System.currentTimeMillis());
              isApplicationForegrounded.set(true);
              listener.onForegrounded(context);
          }
  
          stopActivityTransitionTimer();
      }
docs: React to activity onResume event.
  
  @param context Application context.