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".
Related
Can an Android device pretend and connect as a Bluetooth controller?
Can Android devices connect as a device to, say, a PC and act as a gamepad or similar device?
Is it allowed and doable in code without root access?
I tried this code: Connect Bluetooth devices. But it can not get it to pair.
Short answer, yes.
I recommend looking at Google's example project on Bluetooth communication BlueToothChat initially. Based on what you've written, I think you're missing several important steps.
You need all of the following components / steps:
General Overview
Set up Bluetooth
Set Permissions
Scan for other Bluetooth devices
Query the local Bluetooth adapter for paired Bluetooth devices
Connect to a remote device as client or server
Transfer data over Bluetooth
If you have access to the device your attempting work with as a controller, then you can create your own communication setup. Define a set of parameters to write and read on both sides that emulate the functionality you're looking for.
If you do not have access to creating your own read/write setup, or you want to use standard interaction methods for the industry, then the best bet is the Bluetooth HID Device profile mentioned by #Morrison Chang.
The HID profile basically establish an industry standard of required device features, read/write formats, combinations of features equaling a controller type (ie: "this is a keyboard"), and data mappings for what read/write numbers mean on either side of the client / server connection.
From the linked comment thread, the Kontroller project on Github has source available for your peruse.
There's also a reasonable Intro to Bluetooth HID that covers some of the topics on what Bluetooth HID is actually doing.
Finally, also recommend looking at Google's own BluetoothHidDevice page.
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?
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.
We are working on a project of developing the soft and hardware for a bluetooth LE device.
We implemented GATT services and we are able to connect to the device.
Now the next step: Implement security.
We know that there are tree methods of security:
Just Works
Passkey Entry
Out Of Band
Since our device doesn't have a display (no_input, no_output), we are doomed to use Just Works since OOB is not supported by Android and iOS yet.
So this means we have this bluetooth device with all it's services just hanging there in the open to connect by anybody.
Is this really true in BLE?
We were thinking about implementing our own security just by connecting, writing a key to a keyservice and when that key is correct, the services open themselves for writing/reading. But what would that do with certification?
So you guys are our last resort since we are still hoping we are wrong in this one. Is there anybody who can acknowledge this fact? Or are we missing a big piece of the puzzle?
You can implement Just Works, Passkey Entry and Out Of Band (NFC) on your BLE Device.
Passkey can be written on a label on the product or be hardcoded to 0000 or 1234 or whatever you choose. This works on iOS and Android if you implement correct Bluetooth Security configuration on your BLE Device. What chipset are you using?
Out of Band works fine on Android and Windows Phone with NFC. Maybe Apple iPhone 6 and 6+ will get proper NFC functionality in a more mature iOS version later. On iOS 8.1 it is still just for Apple Pay, not for industri standard NFC functionality.
First step is to set the GATT flags so your Service or Characteristic requires security.
Second step is to implement the bluetooth Security manager messages.
There are official white papers on this on BT Special Interest Group:
https://developer.bluetooth.org/DevelopmentResources/Pages/White-Papers.aspx
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