How does Android poll for NFC devices
Asked Answered
A

1

7

I am working with a contactless reader to communicate with my Android device.

I have observed that any point in time I cannot connect to my Android device using P2P. If I want to connect to initiate an Android Beam transfer I must continuously try to connect to the device multiple times over a one second period.

An NFC Android device can detect contactless cards, NFC P2P targets and NFC P2P initiators i.e. 3 different modes. I am beginning to think that there is some kind of polling going on behind the scenes that switches between the three modes very quickly.

This means that at any given point in time when I try to connect to the phone, it may or may not be in the correct mode and will fail. This is why I need to attempt multiple connections.

I have been looking at the Android source to try and figure this out with no real luck. here is the most promising file I have seen yet but it still makes no sense.

My question is: How does Android detect multiple NFC modes, does it use a switching algorithm and if so what are the specifics of the algorithm?

Thanks.

Antebi answered 23/7, 2013 at 14:53 Comment(0)
L
7

I am beginning to think that there is some kind of polling going on behind the scenes that switches between the three modes very quickly.

Exactly this is going on. The different technologies gets time-multiplexed. It's much more than three modes though. Typically a NFC device will poll for:

  • Reader ISO14443 A
  • Reader ISO14443 B
  • Reader FeliCa (aka tag type 3)
  • Reader ISO15693
  • Card Emulation ISO14443 A
  • Card Emulation ISO14443 B
  • Card Emulation Felica

Peer-to-Peer mode uses Reader A, Reader FeliCa as initiator. Card emulation A and card emulation Felica are also used as Peer-to-Peer Target mode technology.

The exact timing of the polling is not public and you will not find much about that in the source-code. This is handled by the NFC chip internally.

Lidialidice answered 24/7, 2013 at 6:25 Comment(2)
Great answer to confirm my suspicions, thanks. Do you mind me asking how you know this. Have you any reference links I could have a scan over? Thanks.Antebi
Well, I know each and every NFC chip inside out because in my job I actually develop chips and NFC middle-ware. (part of a team of cause). If chips don't work and have connection problems it is often my job to hook up an RF tracer, capture what is going on and dig down to the bit-level where the problem is. So I see the polling loop every day.Lidialidice

© 2022 - 2024 — McMap. All rights reserved.