BLE pairing by NFC on Android - 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.

Related

Is there a working NFC Bluetooth handover example for Android 8.0 and above?

I'm trying to write an Android app (for APIs 21-27) that initiates a Bluetooth connection between two devices when touched together using NFC, but I can't find a working example and the documentation on the subject is limited. I've already read the NFC Forum's document on simple secure Bluetooth pairing (both 1.0 and 1.1) but it is no help since it talks about sending a devices own MAC address, which can no longer be obtained
I've only been able to find two examples of NFC Bluetooth handover and both of them were from before Android nerfed the ability to get a device's own Bluetooth MAC address. Does anyone know of an NFC Bluetooth handover example that is current (>= Oreo) and works?

use Jelly Bean's Simple Secure Pairing ( Bluetooth ) to pair with NFC

As of #io2012 and JellyBean doc there is now a way to pair bluetooth devices via NFC.
That sounds really nice, but I cannot find any documentation about it.
I am especially interested to know if that works with SPP modules that do not support SDP - can I simply write some NFC tag with the PIN-Info and the device gets paired? Would help a lot as a lot of users, that have problems with the PIN-pairing process.
There are two kinds of Bluetooth pairing NDEF messages that are supported by JellyBean. The standardized one defined by the Bluetooth SIG together with the NFC Forum and the (older) proprietary one defined by Nokia (see "What is the tag format to connect the Nokia 6131 NFC with a Bluetooth imaging device?" at http://www.developer.nokia.com/Community/Wiki/Nokia_6131_NFC_-_FAQs#SDK_APIs for some details).
The standardized one does not provide support for PIN. It only supports the new Simple Pairing method. The Nokia-type message has support for PIN. However, when reading the relevant source code from Android that parses such Bluetooth paring NDEF messages (parseNokia() in HandoverManager) you can see that the PIN is not even read out from the NDEF message. So in the end only the built-in PINs in the Android Bluetooth manager will be tried (default ones like 0000 and 1234) to set up a connection if the device is not already known and paired earlier before reading the tag (in which case the NFC tag merely functions as a way to activate the connection).
I also have the impression that this new functionality in Android is firstly supposed to work with audio devices such as head sets. I cannot tell whether it also works with SSP devices (no device to test with myself).
Yes, you can quite simply create an NFC tag with Bluetooth pairing information. Anyhow it will only work for now when the device uses a default pin as Android will only try the default pin 0000 to what I know. you can program such a tag using the NFC TagWriter by NXP.
You might want to have a look at Stanford's EasyNFC library on GitHub.
Especially the BluetoothConnector seems interesting as it "Helps developers set up long-lasting Bluetooth connections across devices".

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

NFC P2P tap between android phones does not seem to work

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.

Categories

Resources