I need to retrieve information from my PWA in response to system events (Android but maybe iOS one day too).
I already have the native code to respond to the Android “Activity” (if that’s the right term) and have my PWA successfully hosted by Capacitor and able to load a custom plugin (I’m just implementing it within the main project for simplicity).
I’m now stuck on a couple of details:
notifyListeners("myPluginEvent", ret);statement in the plugin documentation can’t be invoked from a static method but I don’t see how to get hold of the instance that Capacitor is using so I can’t see how to send an event to the web app.
- I can’t find any documentation about how to respond to the event with some data - it looks like this communication approach is “fire and forget”. Am I overlooking something?
Assuming that (1) is solvable then for (2) I guess I can implement some sort of async communication channel via events and plugin calls by tracking some unique IDs but this seems pretty hacky so I want to get some expert opinions first.