Search code examples
androidnfc

How to detect and write empty NFC tag?


I have to write an android app, which reads and writes NFC tags (only plain texts). If the TAG is writeable, and I touch it to my tablet, I can detect it, and I can write or read it. But, if I touch a new, empty tag, an other app starts automatically. How can I prevent this, and write the empty tag?


Solution

  • I write new, empty tags from within my apps. This requires to enable foreground dispatch of the NFC intents. See: Using the Foreground Dispatch System. There is also sample code available.