This line can sometimes cause a crash:
mySelf.sendEvent("onDeviceActivityMonitorEvent", ["callbackName": name.rawValue])
There is probably a better way to handle the memory management in the NativeEventObserver, or maybe an even better approach to handle message passing.