Currently I am bridging a heremaps sdk on android. I've been looking at the RN documentation for emitting events, and while it is very clear it is not detailed as I'm having trouble figuring how to emit events from a UI View class. The example shows us an example to place in a Module class so I'm a bit confused on the implementation. In below abbreviated example, I initialize a map that attached a listener for navigation events and I planned on sending events to JS on the navigation events. How would I emit the events in the instructListener below?
Would I create a module class for the emitter function? If so, how can I call the sendEvent function from my UI view class?
Apologies in advance as I'm very new to Java/Android dev environment.
MapView.java
imports ...
public class MapView extends MapView {
public HereMapsNavigationView(Context context) {
//initialize map logic
// adds the instructListener
}
//intructListener
public NavigationManager.NewInstructionEventListener instructListener = new NavigationManager.NewInstructionEventListener() {
@Override
public void onNewInstructionEvent() {
// Interpret and present the Maneuver object as it contains
// turn by turn navigation instructions for the user.
m_navigationManager.getNextManeuver();
Maneuver maneuver = m_navigationManager.getNextManeuver();
if (maneuver != null) {
if (maneuver.getAction() == Maneuver.Action.END) {
// notify the user that the route is complete
}
// display current or next road information and emit info to JS
---> place emitter here <----
}
}
};
}