Sending Runtime:dispatchEvent from a plugin.

Is there an equivalent for Runtime:dispatchEvent(…)?

I would like to dispatch a runtime event from my plugin.

I see a dispatchEvent in these docs, but it’s not very descriptive.

http://docs.coronalabs.com/native/android/html/com/ansca/corona/CoronaLua.html

Thanks.

So it looks like CoronaLuaDispatchEvent has been implemented in the Enterprise Android API, but not CoronaLuaRuntimeDispatchEvent.  Will this be available at some point?

So it looks like CoronaLuaDispatchEvent has been implemented in the Enterprise Android API, but not CoronaLuaRuntimeDispatchEvent.  Will this be available at some point?

I really need to send Runtime  event from java as well it exists on iOS : 

http://docs.coronalabs.com/native/ios/index.html#sending-events-to-runtime 

But not on Android, anyone with a workaround ? 

i ended up doing the following helper function 

public static void sendRuntimeEvent(LuaState luaState, String eventName, Map\<String, String\> parameters) &nbsp; { &nbsp; &nbsp; &nbsp; luaState.getGlobal("Runtime"); &nbsp; &nbsp; &nbsp; luaState.getField(-1,"dispatchEvent"); &nbsp; &nbsp; &nbsp; luaState.pushValue(-2); &nbsp; &nbsp; &nbsp; luaState.newTable(); &nbsp; &nbsp; &nbsp; int idx = luaState.getTop(); &nbsp; &nbsp; &nbsp; luaState.pushString(eventName); &nbsp; &nbsp; &nbsp; luaState.setField(idx,"name"); &nbsp; &nbsp; &nbsp; if (parameters != null) { &nbsp; &nbsp; &nbsp; &nbsp; for (Map.Entry\<String, String\> entry : parameters.entrySet()) &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; luaState.pushString(entry.getValue()); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; luaState.setField(idx, entry.getKey()); &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; luaState.call(2, 0); &nbsp; &nbsp; &nbsp; return; &nbsp; } &nbsp;

Cool. Will give that a try.

I really need to send Runtime  event from java as well it exists on iOS : 

http://docs.coronalabs.com/native/ios/index.html#sending-events-to-runtime 

But not on Android, anyone with a workaround ? 

i ended up doing the following helper function 

public static void sendRuntimeEvent(LuaState luaState, String eventName, Map\<String, String\> parameters) &nbsp; { &nbsp; &nbsp; &nbsp; luaState.getGlobal("Runtime"); &nbsp; &nbsp; &nbsp; luaState.getField(-1,"dispatchEvent"); &nbsp; &nbsp; &nbsp; luaState.pushValue(-2); &nbsp; &nbsp; &nbsp; luaState.newTable(); &nbsp; &nbsp; &nbsp; int idx = luaState.getTop(); &nbsp; &nbsp; &nbsp; luaState.pushString(eventName); &nbsp; &nbsp; &nbsp; luaState.setField(idx,"name"); &nbsp; &nbsp; &nbsp; if (parameters != null) { &nbsp; &nbsp; &nbsp; &nbsp; for (Map.Entry\<String, String\> entry : parameters.entrySet()) &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; luaState.pushString(entry.getValue()); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; luaState.setField(idx, entry.getKey()); &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; luaState.call(2, 0); &nbsp; &nbsp; &nbsp; return; &nbsp; } &nbsp;

Cool. Will give that a try.

This was a great help for me too, thanks!

This was a great help for me too, thanks!