NFC P2P tap between android phones does not seem to work - android

I have developed a P2P tag-writing app using NFC for Nexus-S android phones.
The tag contains a text NDEF record and a MIME NDEF record packaged in an NDEF message.The enableForegroundNdefPush is used to enable P2P tag push from one phone to the other.NFC is enabled in both phones.
2 Nexus-S phones are being used to test the app, one for writing and the other for reading.
I am creating and writing the tag using my app present in 1 phone.The other phone is used for reading via the in-built 'Tags' application that comes with the Nexus-S. Other apps like the 'TagWriter' app from NXP has also been tested with.
Out of around 30 tests, only twice, was I able to use the above setup to read the tag.
Other times, the tapping of phones for P2P tag transfer just doesn't work. I wonder if others are having the same issue.
Thanks
Riyaz

For receiving the P2P, what are you using?
enableForegroundDispatch or general intents to determine the tags?
IF using enableForegroundDispatch, be careful as techfilter should be appropriate as being used by the app that is writing the tags.
I personally never used two different type of records within 1 message however, used simple text NDEF message it worked.
-Cheers,AA

Foreground push and dispatch have worked for me reasonably reliably with two Nexus S devices. There was an occasion when foreground dispatch fails to work. I managed to resolve the issue by simply removing the battery cover, inspect and clean the (metal) NFC antenna connection and reinstall the cover, making sure it's a snug fit.

Related

BLE pairing by NFC on Android

I'm trying to use NFC in order to pair two Android BLE devices. I followed latest specifications released from NFC Forum & BT SIG, called Bluetooth Secure Simple Pairing Using
NFC and I'm interested in static handover. This means I'd to write an NDEF message on an NFC tag (formatted according to specifications above) with one device, then the other one reads this tag and keep information to start BLE pairing. I'm using Android 4.4.2. and this approach works fine with Bluetooth, with no need to have specific app to manage handover, Android does the work!
But with BLE this approach doesn't work. I think the problem is related to MIME-type that I'd to write in NDEF message. For Bluetooth is application/vnd.bluetooth.ep.oob while for BLE is application/vnd.bluetooth.le.oob. When I tap device/tag, Android detects that there's a new tag with BLE MIME-type but doesn't perform any action, just shows me the screen "New tag collected", like it was unknown MIME-type. I noticed that NFC Forum specifications was released on 2014-01-09 and in Compatibility document for Android 4.4 there aren't references about BLE handover, just Bluetooth.
Does someone know if BLE pairing by NFC is supported and works on Android 4.4? And on Android 5?
I managed to test NFC/BLE handover on a Nexus 6 running Android 5 and the MIME-type application/vnd.bluetooth.le.oob has been recognised! Therefore the limit is in the Android version ...
If you want to read characteristic, you need to use read method of that property. Sample given with the SDK 4.3 works good. Also connectivity problem exists in all other devices except Samsung.

Is it possible to with one touch two Android devices exchange data via NFC?

I want to create an application to exchange information between 2 devices via NFC.
I know how to make one mobile send information to the other using Android Beam. What I don't know is how two phones could send data to each other with just one touch.
Is this possible? If yes, how?
That depends on what you are trying to achieve and what Android version(s) you are using:
Both devices with Android < 4.0
Both devices can send one NDEF message each with no user interaction required. The messages cannot depend on each other (i.e. it's not possible that one device sends a message and the other one sends an answer to this). You would use a combination of enableForegroundNdefPush() and enableForegroundDispatch() to achieve this.
At least one device with Android < 4.4
Both devices can (theoretically) send one NDEF message per touch, but user interaction is required on both devices (i.e. the user needs to touch the Beam UI). Moreover the Beam UI on both devices needs to be touched pretty much at the same time. Otherwise, the Beam UI on the other device will get interrupted due to the received NDEF message. Thus, this "solution" is not really usable. You would use a combination of setNdefPushMessage*() and enableForegroundDispatch() to achieve this.
Both devices with Android 4.4+
Starting with version 4.4, Android has two new features:
NFC reader mode and
Host-based Card Emulation (HCE).
When you combine those feature (i.e. you have a HCE on-host card emulation service on one device and put the second device into reader mode), both devices can communicate with each other (real bi-directional communication) using ISO 7816-4 APDUs.
This is possible, as explained online here. There is also an API demo in the API demos provided with the SDK that discusses this.
However, keep in mind that NFC has a very small payload size, and you're unlikely to be able to transfer any sizable data using it. NFC should instead be used to quickly setup bluetooth connections, or another form of wireless transfer like WiFi direct, which can then be used to transfer larger amounts of data.

Android application to mimic a physical RFID card

Is it possible for an Android application to send a previously stored RFID card ID to a NFC reader? The aim would be to use an Android device to enable access to a room instead of a physical RFID card.
Having read a lot of other threads about NFC/RFID & card-emulation, I came to the conclusion it was not available for now in Android but I'm still kinda confused if it apply to this particular case. Can't the application simply send the card ID within a NDEF message or an APDU command or I'm just completely dreaming?
Well, strictly speaking. For what you want to do you don't need card emulation. You just need to send a token to the door lock that can be validated.
You could do this with Android beam by pushing an NDEF message to a device that is compatible, SNEP is the protocol you'll be looking for.
A solution I would prefer would be to get the door lock device to emulate a tag. Then you could have your Android app register a listener for that tag (Doesn't even need to be running). When the tag is detected that app will fire up and send your secure token to the lock by using the tag write NFC functions in the Android SDK.
Securing your token is another matter.
The android view:
Long story short: It's not possible.
Long story long:
It would be possible from a hardware and software point of view to do this. The NFC chips are perfectly capable to emulate most (not all) standard tags. The functionality to do this is even built in the lower level software but not exposed to applications.
Why: Emulating tags is what the entire mobile payment infrastructure is built upon. Allowing two card emulations of the same type at once is for most NFC chips not possible and will also shut off mobile payment as mobile payment readers only accept a single tag at once (for security reasons).
Things are a bit different for RIM based Blackberry phones, they allow card emulations (even have this feature out of the box) but they don't do any mobile payment at the moment as far as I know.

Share tag NFC between two device Android

It is possible?
I state that NFC is enabled on my phone and everything looks correct
I tried with an app called NFC TagWriter by NXP but don't work.
I create a tag with this app and then I tried to listen with other device but don't work, then I installed same app on the other device but don't work.
Please help me or suggested to me another way to do(share tag NFC).
THANKS!
The Android Beamâ„¢ feature allows a device to push an NDEF message onto another device by physically tapping the devices together. This interaction provides an easier way to send data than other wireless technologies like Bluetooth, because with NFC, no manual device discovery or pairing is required. The connection is automatically started when two devices come into range. Android Beam is available through a set of NFC APIs, so any application can transmit information between devices. For example, the Contacts, Browser, and YouTube applications use Android Beam to share contacts, web pages, and videos with other devices.
Reference from Developer Documentation
Also check this for Blog , it explains how to communicate between devices.
You can have (indepedent) p2p communication in 2 directions, and enableForegroundNdefPush is deprecated now; please, use setNdefPushMessage

How to send data between two devices using NFC in android?

Hi i am developing a simple application using NFC in android. The NFC api is available in android version 2.3.3 and above. The is a documentation and simple demo code to communicate NFC enabled android device and NFC tag.
I find the sample code from the below link.
http://developer.android.com/resources/samples/NFCDemo/index.html
And i did not find any useful code to communicate between two android devices.Please suggest me some example how we can do p2p communication between two android devices.
Thanks in advance
Sorry if i have to disappoint you, but active p2p communication between 2 Android devices for the moment is not possible. Although you can push NDEF messages between 2 devices using p2p. This works the following way. One of the phones registers NDEF message to be pushed and as soon as the other phone enter the field of the other phone this message is exchanged. In the ICS, Beam UI appears on the sending phone to ask the user for confirmation to send the message. All this looks more like the one of the phones emulates a tag, just the difference is that LLCP protocol is used from communication.
If this behavior is good for your use-case you can find on this blog good explanation how to use achieve this:
http://www.jessechen.net/blog/how-to-nfc-on-the-android-platform/
and also look at NFCAdapter doc (enableForegroundNdefPush and enableForegroundDispatch)
http://developer.android.com/reference/android/nfc/NfcAdapter.html#enableForegroundNdefPush%28android.app.Activity,%20android.nfc.NdefMessage%29
This is possible since Android version 4.x with the Beam service. Read more

Categories

Resources