title: ionic react native->js communication
body: <p>I'm a native Android/iOS dev new to ionic capacitor and javascript in general. I'm trying to send data from Android's OnNewIntent callback to the ionic-react project I'm working on. I'm doing this in the native MainActivity.java that extends BridgeActivity:</p>
  
  <pre><code>  @Override
    protected void onNewIntent(Intent intent) {
      super.onNewIntent(intent);
      getBridge().triggerDocumentJSEvent("MyEvent","blah");
    }
  </code></pre>
  
  <p>And in my App.tsx file, I have something like this:</p>
  
  <pre><code>const App: React.FC = () =&gt; {
    const onMyEvent = (input: string): void =&gt; {
      console.log('event received: ${input}');
    };
  
    useEffect(() =&gt; {
      document.addEventListener('MyEvent', () =&gt; {
        console.log('MyEvent document');
        onMyEvent(it.name);
      });
  
      window.addEventListener('MyEvent', () =&gt; {
        console.log('MyEvent window');
        onMyEvent(it.name);
      });
    }, []);
  </code></pre>
  
  <p>but I can't for the life of me get a message through from the native Activity to the App.tsx file. I've tried delaying the trigger for up to 15 seconds after the Activity is resumed to make sure everybody is instantiated, but I still never see indication that the message has been received. Is there an easy way to communicate from the native layer to the capacitor layer that I'm missing? Is it that these early Android lifecycle events happen before the ionic listeners have a chance to register? Just trying to send startup data that only the native side knows to the ionic side before rendering the first screen.</p>
  
  <p>Thanks!
  Scott </p>