Search code examples
androidandroid-intentnfcnexus-7

Intent NFC discovery does not (always) fire on Nexus 7


With the app that I'm developing, I have a problem with the NFC functionality on my Nexus 7. On all other devices, that problem does not exist:

Usually, when detecting an NFC chip, the function onNewIntent is called with the NFC-related intent. Most of time everything goes well. But sometimes, on the Nexus 7, the function onNewIntent is not called. When this happens, sound that is played upon tag detection is different than usual. After that, the NFC detection does not work at all and I have to disable and re-enable NFC in the Settings app.

Did someone already encounter this problem? The fact that I have this problem only on the Nexus 7 makes me think this could be a hardware problem - but I may be wrong ...

Android: 4.4.4 | Device: Nexus 7 2013 | Tag: NTAG203 chip


Solution

  • The different sound (I assume this one (or possibly only this one) instead of the one that you would hear upon success) is typically played when the device could not establish communication with a detected tag.

    This could have various reasons, for instance, that the tag was not properly placed on the device's NFC antenna, or that the tag's antenna does not sufficiently couple with the device's NFC antenna and that, consequently, the tag did not receive sufficient power to wake up on time or that the Nexus 7 did not detect the tag's response (due to too little modulation depth).

    Sometimes, such a problem with NFC tag detection results in crashes of the NFC system service (that's what happens in your case and what you recover from by re-enabling NFC in the Settings app).

    Anyways, as the tag was not properly detected by the Android system (and as the NFC service crashed), no NFC discovery intents will be passed to your app.