In part 10 we’re going to cover two wireless connectivity capabilities – NFC and Bluetooth.



Serial Port Profile
Serial Port Profile [SPP] lets you transmit/receive arbitrary data – you can talk to many peripherals, including printers, signature capture pads, or even other phones.

Handling SPP communications is easy on BlackBerry 10. As you’d expect on the POSIX system – it’s done through files. You can read and write to an established SPP connection as you would any other file.

Creating an SPP connection to a server is as hard as:

Creating an SPP server is as hard as:

Oooh! Callbacks! C’s “idea” of events… That function is called as soon as a peer connects to you.

However, there is some initialization to take care of. I strongly recommend looking at the demo the Bluetooth development team built here.

Object Sharing
The invocation framework is a huge help here. By sharing, you get the data sent to a Bluetooth peer with very little work.

Bluetooth Low Energy
While BlackBerry Java devices didn’t support Bluetooth Low Energy, BlackBerry 10 does. If you’re working with some LE peripherals or just interested, have a look at this great primer (and demo):


NDEF Tags:


Reading tags is now handled by the invocation framework. The registration in your bar-descriptor.xml is all you need to have configured – you don’t need any NFC/NDEF specific code to get the payload of a tag. Reading tags is much simpler in BlackBerry 10 than previously.

Let’s break down the invocation target that was used for the Scavenger Hunt application used at some recent BlackBerry Live events:

The value here is where your control comes from. If your URI is specific (like the one above) you’ll only get that content. If your URI is just ndef:// – you’ll get any and all NDEF tags read by the device (assuming the user chooses your application – instead of some other built in one).

The 2 in the URI is the NDEF TNF! In this case, 2=MEDIA. (Some purists may argue that I should’ve used type 4=EXTERNAL – but I didn’t )

The TNF for WELL_KNOWN is 1. The type for Smart Posters is Sp – given this, the URI for accepting Smart Poster tags is:



Want to keep all of your tag reading (and creating) in QML? Then all you need is a JavaScript library to process the received payload from the invocation event, which can be found here.

Writing a NDEF Tag
There are a few ways to write tags. I believe that the quickest is through sharing with the invocation framework.

You can build an NDEF tag duplicator by:

  1. Having an invocation target that receives NDEF tags.
  2. Sharing the NDEF tag payload – to keep on writing tags.

From an aesthetic point of view, sharing interrupts your application when the system card takes control – you can write using low level functionality too.

Other Tech (Peer 2 Peer, SNEP, Card Emulation…)
Want more details – or to see some samples? For NFC on BlackBerry there is only one place to go:


Read the article: 

BlackBerry Java to BlackBerry 10 Cascades Porting Series – Part 10: NFC and Bluetooth