private void callOnActive(Runnable r){
synchronized (onActiveListeners) {
    if (isActive) {
      r.run();
    }
 else {
      onActiveListeners.add(r);
    }
  }
}

private void callOnActive ( Runnable r ) { synchronized ( onActiveListeners ) { if ( isActive ) { r . run ( ) ; } else { onActiveListeners . add ( r ) ; } } }
calls the given runnable when the app is active . if the app is already active , it will call it immediatly . if not , it will be called in applicationdidbecomeactive ( ) . this is used for getting the apparg property in a way that avoids race conditions .
