I'm working on an app in react native and I implemented a module that sends java event to js so it can be listened in react native.
Is there any way to listen it in another java file?
Here is the example event:
int score = 10;
sendEvent("SCORE", score);
The module itself looks as below:
// Called to emit events to event listeners in JS
private void sendEvent(String eventName, int result) {
getReactApplicationContext()
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, result);
I can read it with listener in js, but have no clue how to read it in another java file.