2

I know how to receive and handle nfc broadcasts to the device.

I have an opposite process question:

Is there a way to detect if a device is not receiving nfc broadcasts?

That is can the nfc tag can be used as some kind of circular transmitter which the device can detect when its get out of the nfc range?

Michael A
  • 5,770
  • 16
  • 75
  • 127
  • You can always try polling data with the current NFC tag connection and when you get an exception, you know when the tag is out of range. – einschnaehkeee Apr 27 '15 at 09:36
  • possible duplicate of [How to confirm whether there is a NFC tag exists in Android now?](http://stackoverflow.com/questions/23441430/how-to-confirm-whether-there-is-a-nfc-tag-exists-in-android-now) – Michael Roland Apr 27 '15 at 19:20

1 Answers1

1

I know for a fact that Google Cardboard had a function like this but it seems they have removed this function for some reason.

However it shouldn't be too difficult to implement this yourself.

If your default state is out of range you can set it to in range when you receive a broadcast. Then after a period of time you check if it is still there (maybe by trying to read the header, if this fails you know it is out of range).