简体   繁体   中英

android device in homescreen as NFC target

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 that 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 eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM