title: Ionic Capacitor Deep links (appUrlOpen) event running multiple times 10+
body: <p>I'm building an app where I have deep links to open app and run a specific function based on the url.
  But the event triggers multiple times and run same function after that I have 10+ alerts which needs to be confirmed.</p>
  <p>This is from running app on real device with livereload</p>
  <p>Here is my code as React Component</p>
  <pre><code>import { useEffect } from &quot;react&quot;;
  import { App, URLOpenListenerEvent } from &quot;@capacitor/app&quot;;
  
  import { useCamera } from &quot;src/hooks&quot;;
  
  const AppUrlListener: React.FC&lt;any&gt; = () =&gt; {
    const { startActionApprovalProcess } = useCamera();
  
    useEffect(() =&gt; {
      App.addListener(&quot;appUrlOpen&quot;, (event: URLOpenListenerEvent) =&gt; {
        let actionUrl: string | null = event.url.replace(&quot;myrecheck&quot;, &quot;https&quot;);
        startActionApprovalProcess(actionUrl);
        actionUrl = null;
      });
      App.addListener(&quot;appStateChange&quot;, event =&gt; {
        console.log(&quot;appStateChange:&quot;, JSON.stringify(event));
      });
    }, [startActionApprovalProcess]);
  
    return null;
  };
  
  export default AppUrlListener;
  </code></pre>
  <p>I'm importing it on App.tsx (Firebase Notifications Listener too which runs multiple times again) like a normal component</p>
  <pre><code>&lt;AppUrlListener /&gt;
  &lt;NotificationsListener /&gt;
  </code></pre>
  <p>And here are my console logs
  First I'm moving from app to the browser state changes
  Then open app from deep link and runs the event from which comes origin logs
  Then comes apps new state
  And then again logs from my function</p>
  <pre><code>VM3:207 result App.addListener (#8693379)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:false}
  VM3:207 result App.addListener (#8693383)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:false}
  VM3:207 result App.addListener (#8693385)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:false}
  VM3:207 result App.addListener (#8693387)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:false}
  VM3:207 result App.addListener (#8693389)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:false}
  VM3:207 result App.addListener (#8693391)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:false}
  VM3:207 result App.addListener (#8693393)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:false}
  VM3:207 result App.addListener (#8693395)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:false}
  VM3:207 result App.addListener (#8693402)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:false}
  VM3:207 result App.addListener (#8693404)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:false}
  VM3:207 result App.addListener (#8693378)
  qr-decode.ts:12 url origin https://my.recheck.io
  VM3:207 result App.addListener (#8693382)
  qr-decode.ts:12 url origin https://my.recheck.io
  VM3:207 result App.addListener (#8693384)
  qr-decode.ts:12 url origin https://my.recheck.io
  VM3:207 result App.addListener (#8693386)
  qr-decode.ts:12 url origin https://my.recheck.io
  VM3:207 result App.addListener (#8693388)
  qr-decode.ts:12 url origin https://my.recheck.io
  VM3:207 result App.addListener (#8693390)
  qr-decode.ts:12 url origin https://my.recheck.io
  VM3:207 result App.addListener (#8693392)
  qr-decode.ts:12 url origin https://my.recheck.io
  VM3:207 result App.addListener (#8693394)
  qr-decode.ts:12 url origin https://my.recheck.io
  VM3:207 result App.addListener (#8693401)
  qr-decode.ts:12 url origin https://my.recheck.io
  VM3:207 result App.addListener (#8693403)
  qr-decode.ts:12 url origin https://my.recheck.io
  VM3:207 result App.addListener (#8693379)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:true}
  VM3:207 result App.addListener (#8693383)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:true}
  VM3:207 result App.addListener (#8693385)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:true}
  VM3:207 result App.addListener (#8693387)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:true}
  VM3:207 result App.addListener (#8693389)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:true}
  VM3:207 result App.addListener (#8693391)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:true}
  VM3:207 result App.addListener (#8693393)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:true}
  VM3:207 result App.addListener (#8693395)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:true}
  VM3:207 result App.addListener (#8693402)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:true}
  VM3:207 result App.addListener (#8693404)
  index.tsx:16 appStateChange: {&quot;isActive&quot;:true}
  qr-decode.ts:17 Success new apiUrl:  https://my.recheck.io
  VM3:233 native App.getInfo (#8693412)
  qr-decode.ts:17 Success new apiUrl:  https://my.recheck.io
  VM3:233 native App.getInfo (#8693413)
  qr-decode.ts:17 Success new apiUrl:  https://my.recheck.io
  VM3:233 native App.getInfo (#8693414)
  qr-decode.ts:17 Success new apiUrl:  https://my.recheck.io
  VM3:233 native App.getInfo (#8693415)
  qr-decode.ts:17 Success new apiUrl:  https://my.recheck.io
  VM3:233 native App.getInfo (#8693416)
  qr-decode.ts:17 Success new apiUrl:  https://my.recheck.io
  VM3:233 native App.getInfo (#8693417)
  qr-decode.ts:17 Success new apiUrl:  https://my.recheck.io
  VM3:233 native App.getInfo (#8693418)
  qr-decode.ts:17 Success new apiUrl:  https://my.recheck.io
  VM3:233 native App.getInfo (#8693419)
  qr-decode.ts:17 Success new apiUrl:  https://my.recheck.io
  VM3:233 native App.getInfo (#8693420)
  qr-decode.ts:17 Success new apiUrl:  https://my.recheck.io
  VM3:233 native App.getInfo (#8693421)
  VM3:207 result App.getInfo (#8693412)
  VM3:207 result App.getInfo (#8693413)
  VM3:207 result App.getInfo (#8693414)
  VM3:207 result App.getInfo (#8693415)
  VM3:207 result App.getInfo (#8693416)
  VM3:207 result App.getInfo (#8693417)
  VM3:207 result App.getInfo (#8693418)
  VM3:207 result App.getInfo (#8693419)
  VM3:207 result App.getInfo (#8693420)
  VM3:207 result App.getInfo (#8693421)
  </code></pre>
  <pre><code>Ionic:
  
     Ionic CLI       : 6.17.0 (/Users/byurhanbeyzat/.nvm/versions/node/v16.3.0/lib/node_modules/@ionic/cli)
     Ionic Framework : @ionic/react 5.7.0
  
  Capacitor:
  
     Capacitor CLI      : 3.1.2
     @capacitor/android : 3.2.2
     @capacitor/core    : 3.2.2
     @capacitor/ios     : 3.2.2
  
  Utility:
  
     cordova-res                          : not installed globally
     native-run (update available: 1.4.1) : 1.4.0
  
  System:
  
     NodeJS : v16.3.0 (/Users/byurhanbeyzat/.nvm/versions/node/v16.3.0/bin/node)
     npm    : 7.21.1
     OS     : macOS Big Sur
  </code></pre>