I can solve the problem by using an additional flag that will get communicated from Javascript to Java. But an extra flag felt redundant to my taste. My Java native code needs to do something in its state and then notify the Javascript layer about this. But my concern is that, if the Javascript layer did not call the NativeEventEmitter::addListener, then the changes made on the Java native side won't get communicated to the Javascript side. So I first need to determine that Javascript is listening for this event. Otherwise, no state changes on the Java side.
Like I said, a trivial boolean flag and the extra native call to have this flag communicated to the Java side could solve this problem. But I worry that such extraneous method would cause things to go out-of-sync by accident, via javascript programming mistake. I, therefore, am inclined to check if Javascript is listening for the event. How can Java React Native find out if there is a listener?