Android check if nfc tag is near

独自空忆成欢 提交于 2019-12-13 00:41:22

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/26860474/android-check-if-nfc-tag-is-near

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!