1

Is it possible to check (periodically) if a nfc tag is near? I want to put an nfc tag inside a car holder and wenn i take the phone out of the car, the phone should stop sending GPS.

All i could find was this: How to find out whether an NFC tag is still in range of an Android now? But in my scenario the Display is off.

Is there a way to do this or is there a way to detect when there is no nfc tag?

Community
  • 1
  • 1
user2304379
  • 59
  • 1
  • 8

1 Answers1

3

Unfortunately you can't when the display is off. Android's reader/writer mode is disabled when the screen is off.

Beside the default behaviour of Android's NFC, there is an application which make it possible to detect NFC tags when the screen is off (or even locked). I did not tested it myself, but if you want to achieve this you can give it a try. I guess your phone needs to be rooted to use this application.

S.Pols
  • 3,414
  • 2
  • 21
  • 42
  • 1
    Is it possible to make NFC/HCE work when is screen off? – ondermerol Sep 30 '15 at 18:16
  • Without rooting it isn't. From the Android docs: "Current Android implementations turn the NFC controller and the application processor off completely when the screen of the device is turned off. HCE services will therefore not work when the screen is off.". Read here more info: https://developer.android.com/guide/topics/connectivity/nfc/hce.html#ScreenOffBehavior – S.Pols Oct 01 '15 at 05:51
  • Thank you, I understand better now. – ondermerol Oct 01 '15 at 06:37
  • Could you mind helping me about my another new question in http://stackoverflow.com/questions/32881538/can-we-download-the-payment-application-that-uses-hce-in-the-phones-with-lower-t – ondermerol Oct 01 '15 at 07:16