To be called from an Activity or Fragment's onPause method.
342956
public void onPause() {
        // remove the broadcast receiver
        broadcastManager.unregisterReceiver(receiver);

        if (callback != null) {
            Session session = Session.getActiveSession();
            if (session != null) {
                session.removeCallback(callback);
            }
        }
    }
1316374
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Fragment fragment = getSupportFragmentManager().findFragmentById(android.R.id.content);
        if (fragment == null) {
            fragment = MainFragment.newInstance(getIntent().getExtras());
            getSupportFragmentManager()
                    .beginTransaction()
                    .replace(android.R.id.content, fragment, "")
                    .commit();
        } else {
            getSupportFragmentManager()
                    .beginTransaction()
                    .attach(fragment)
                    .commit();
        }
    }
1230080
@NonNull
    private Activity getActivity() {
        Activity result = null;
        if (activity != null) {
            result = activity;
        } else if (fragment != null) {
            result = fragment.getActivity();
        } else if (fragmentSupport != null) {
            result = fragmentSupport.getActivity();
        }
        if (result == null) {
            throw new NullPointerException("No activity or fragment instance");
        }
        return result;
    }
960071
function onActivity(e) {
      if (!_shouldActivityUpdate(e)) return;
      if (_shouldRestart()) return dispatch(context.actions.start());
      /** THIS WILL BE ROUTED TO FAST OR LOCAL STATE IF ENABLED */
      setState(_constants.IDLEMONITOR_ACTIVITY, { lastActive: +new Date(), lastEvent: { x: e.pageX, y: e.pageY } });
    }
1276482
@Override
    public void onActivityStarted(Activity activity) {
        HMSAgentLog.d("onStarted:" + StrUtils.objDesc(activity));
        setCurActivity(activity);
    }
985524
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    recoverDraggablePanelState(savedInstanceState);
    loadLastPlaceClicked(savedInstanceState);
  }
430078
private void togglePause() {
        OffsetItem pauseOffsetItem = fsuipcInterface.read(new OffsetIdent(0x0262, 2));
        int pauseOffsetValue = pauseOffsetItem.getValue().toShort();
        switch(pauseOffsetValue) {
            case 0:
                fsuipcInterface.write(new OffsetItem(0x0262, 2, ByteArray.create("1", 2)));
                break;
            case 1:
                fsuipcInterface.write(new OffsetItem(0x0262, 2, ByteArray.create("0", 2)));
                break;
            default:
                throw new IllegalStateException("invalid value - " + pauseOffsetValue);
        }
    }
487783
def pause(self):
        """"""
        if self.state == PygAnimation.PLAYING:
            self.elapsedAtPause = self.elapsed
            # only change state if it was playing
            self.state = PygAnimation.PAUSED

        elif self.state == PygAnimation.STOPPED:
            pass  # nothing to do

        elif self.state == PygAnimation.PAUSED:
            pass
564646
public synchronized void resumeReceives() {
        receivesSuspended = false;if(Thread.currentThread() == channel.getIoThread()) {
            doResume();
        } else {
            channel.getIoThread().execute(new Runnable() {
                @Override
                public void run() {
                    doResume();
                }
            });
        }
    }
502974
public void resumeStanzaAndPEPListeners() {
        PepManager pepManager = PepManager.getInstanceFor(connection());
        CarbonManager carbonManager = CarbonManager.getInstanceFor(connection());

        // Remove listeners to avoid them getting added twice
        connection().removeAsyncStanzaListener(internalOmemoMessageStanzaListener);
        carbonManager.removeCarbonCopyReceivedListener(internalOmemoCarbonCopyListener);
        pepManager.removePepListener(deviceListUpdateListener);

        // Add listeners
        pepManager.addPepListener(deviceListUpdateListener);
        connection().addAsyncStanzaListener(internalOmemoMessageStanzaListener, omemoMessageStanzaFilter);
        carbonManager.addCarbonCopyReceivedListener(internalOmemoCarbonCopyListener);
    }
399354
@Override
  protected void onStop()
  {
    super.onStop();

    String email = emailField.getText().toString();

    if( email == null )
      return;

    SharedPreferences settings = getSharedPreferences( PREF_TAG, 0 );
    SharedPreferences.Editor editor = settings.edit();
    editor.putString( EMAIL_PREF, email );
    editor.commit();
  }
1073336
private void setInactivityTimer(long ms) {
        if (sessionInactivityTimer == null) {
            sessionInactivityTimer = new SessionInactivityTimer(sessionHandler.getScheduler(), this);
        }
        sessionInactivityTimer.setIdleTimeout(ms);
    }
1311560
public void onCreate(Bundle savedInstanceState) {
		LOGGER.debug("Executing onCreate on " + fragment);
		fragment.setRetainInstance(getFragmentIf().shouldRetainInstance());

		fragmentDelegatesMap = Maps.newHashMap();
		for (AppModule appModule : AbstractApplication.get().getAppModules()) {
			FragmentDelegate fragmentDelegate = getFragmentIf().createFragmentDelegate(appModule);
			if (fragmentDelegate != null) {
				fragmentDelegatesMap.put(appModule, fragmentDelegate);
				fragmentDelegate.onCreate(savedInstanceState);
			}
		}
	}
273810
private final void waitForActivityIfNotAvailable(){
		if(activityStack.isEmpty() || activityStack.peek().get() == null){

			if (activityMonitor != null) {
				Activity activity = activityMonitor.getLastActivity();
				while (activity == null){
					sleeper.sleepMini();
					activity = activityMonitor.getLastActivity();
				}
				addActivityToStack(activity);
			}
			else if(config.trackActivities){
				sleeper.sleepMini();
				setupActivityMonitor();
				waitForActivityIfNotAvailable();
			}
		}
	}
334767
@Override
    public void resume() throws PauseableComponentException {
        try {
            shouldActivate = true;
            if (ivState == INACTIVE_STATE) {
                activateEndpoint();
            } else if (ivState == ACTIVE_STATE) {
                Tr.info(tc, "MDB_ENDPOINT_ALREADY_ACTIVE_CNTR4118I", beanMetaData.enterpriseBeanName, beanMetaData.getModuleMetaData().getName(),
                        beanMetaData.getModuleMetaData().getApplicationMetaData().getName());
            } else {
                throw new PauseableComponentException(Tr.formatMessage(tc, "MDB_ENDPOINT_DID_NOT_RESUME_CNTR4120W", beanMetaData.enterpriseBeanName,
                                                                       beanMetaData.getModuleMetaData().getName(),
                                                                       beanMetaData.getModuleMetaData().getApplicationMetaData().getName()));
            }
        } catch (ResourceException re) {
            throw new PauseableComponentException(re);
        }

    }
701668
void onActivityReady(Activity activity) {
    this.activity = activity;

    PermissionStates permissionStates = null;
    synchronized (pendingPermissionsMutex) {
      if (activity != null) {
        permissionStates = getPermissionStates(pendingPermissions);
      }
    }

    if (permissionStates != null) {
      handleDeniedPermissions(permissionStates.getDeniedPermissions());
      updatePermissionsAsDenied(permissionStates.getImpossibleToGrantPermissions());
      updatePermissionsAsGranted(permissionStates.getGrantedPermissions());
    }
  }
638291
@Override
    public void onActivityResumed(Activity activity) {
        HMSAgentLog.d("onResumed:" + StrUtils.objDesc(activity));
        setCurActivity(activity);

        List<IActivityResumeCallback> tmdCallbacks = new ArrayList<IActivityResumeCallback>(resumeCallbacks);
        for (IActivityResumeCallback callback : tmdCallbacks) {
            callback.onActivityResume(activity);
        }
    }