0

I am working on reading RFID. When I use my app. The app detects the RFID and show the result in the app. But also the phone opens browser which is duplicate. And I don't need the browser one.

The browser opens up even if my app is not installed on the phone after detecting the RFID.

How can I block opening the browser but only works on my app?

c-an
  • 3,543
  • 5
  • 35
  • 82
  • Check [this](https://stackoverflow.com/questions/27712115/launch-specific-app-when-nfc-is-discovered) – M D May 02 '19 at 04:44
  • Thanks. But I have just one app and the default browser(chrome) keeps opening... How can I solve it? – c-an May 02 '19 at 05:13
  • Do you want to prevent the browser from being opend while your app is launched and visible in the foreground? Or do you want to prevent any app (except yours) to be started by scanning the tag, even if your app is not installed on the device? – Michael Roland May 02 '19 at 09:48

1 Answers1

0

The same issue was coming on my app also, it's a flutter app though (on Android). The key to the solution for my case was that the browser was only opening when my app was not actively scanning or having an active NFC session; which means if my app has requested the polling or is requesting the tag data (basically having an active NFC session), then the browser was not opening.

So the solution is to wait (4 seconds in my case) before closing the session, after receiving data. Earlier what was happening was, as I get the data, I closed the session and then OS takes over the NFC scanning; and because the tag is still near the device, OS also detects it and opens the browser.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253