开发者

android device in homescreen as NFC target

开发者 https://www.devze.com 2023-03-19 21:44 出处:网络
When an android device with NFC is in home screen (screen on of course, otherwise the NFC won\'t work), does it act as an NFC target? If so, what data does it show?

When an android device with NFC is in home screen (screen on of course, otherwise the NFC won't work), does it act as an NFC target? If so, what data does it show?

In other words, can I write an app for one phone 开发者_StackOverflowthat can identify other phones (without any propriety app)?


you can communicate with other NFC phone in the so-called NFC p2p mode (see the example here). In this case must be on both devices your application installed.

The other option for the device is to act as a NFC tag reader/writer - but this is not an option for your application, because in this mode phone communicates with the passive NFC tags.

The third option is to enable the phone to work in card emulation mode. In this mode phone mode emulates the contactless smart card. This is not possible with current Android OS version API and it is anyway intended only for e.g. banking and payment applications.


See http://developer.android.com/reference/android/nfc/Tag.html

First, if any app enabled foreground dispatch, those will get notified. In your case - it's at the home screen, so this does not applies. Afterwards, it basically goes through the intents list to see if any app is interested at any tag.

In the other word, when the screen is on and at the home screen, the behavior is like you have QR code scanner always scanning for QR code, and Browser/Phone Contact/Whatever app when a corresponding code is scanned - except is this case it's about NFC tag, not QR code.

The phone never act as tag (passive device) except in specific payment mode (Google checkout) - aka card emulation mode. However, the API does not expose this mode for developer.

0

精彩评论

暂无评论...
验证码 换一张
取 消