Team BlackBerry is heading down to Africa

Guest post from Marysia- Ed.

TITLE_IMAGE

This June and July our EMEA superstar evangelists will be heading down to Africa to spread the BlackBerry 10 love.

If you have never developed for BlackBerry 10 before and would like to learn how to go from nothing to a fully functioning app using either HTML5 or C++/Qt Cascades, then you should come and join us for one of the tour stops around the continent.

Our team will be on hand all day to give you all the tips and tricks you need to build a beautiful app that users will love and value.

To find out more and to register for a place check out the links below. Spaces are limited and are filling fast so don’t wait!

BlackBerry Jam Tunisia 14th June

BlackBerry Jam Kenya 21st June

BlackBerry Jam Ghana 1st July

BlackBerry Jam Nigeria 3rd July

BlackBerry Jam South Africa date tbc

BlackBerry 10 Dev Alpha – To Brick or Not to Brick… That is the Question…

TITLE_IMAGE

For those developers who’ve been part of the BlackBerry 10 Dev Alpha program with either a BlackBerry 10 Dev Alpha A or BlackBerry 10 Dev Alpha B, there’s a date upon which you may have been keeping a watchful eye: June 30th, 2013… the day the BlackBerry 10 Dev Alpha testing devices are set to be deactivated. Or are they?

The BlackBerry 10 Dev Alpha testing devices were seeded to our development community in advance of the BlackBerry 10 launch to ensure hardware availability to our devs well ahead of launch. Now that launch has come and gone (and so too has the date for the BlackBerry 10 Limited Edition device!), those BlackBerry 10 Dev Alpha testing devices start falling into the category of unsupported hardware since they were never intended to be a full commercial product nor do they support the full OS builds. But really, they still work, so why throw away a perfectly good device? Good news! You don’t have to.

If you saw the blog post advising devs of the BlackBerry 10.1 SDK OS update (SDK OS indicates that it’s not a full OS release, but rather an OS build that features a reduced set of apps – basically what you need to develop and build against), then you’ll be pleased to learn that the 10.1 SDK OS also had the side benefit of removing the date that was to disable the BlackBerry 10 Dev Alpha testing devices. In other words, for any BlackBerry 10 Dev Alpha owners, if you’ve updated to the 10.1 SDK OS build, your device will continue to work beyond the June 30th date, with no imposed expiry date embedded in the OS.

The BlackBerry 10 Dev Alpha A hardware will continue to be officially unsupported and the BlackBerry 10 Dev Alpha B hardware will join those same ranks on June 30th, but if you want to continue to developing apps against those devices beyond that date, you’re welcome to do so.

For more info on the BlackBerry 10 Dev Alpha program and to view other FAQs, please visit the BlackBerry 10 Dev Alpha web page.

BlackBerry at Unite Nordic 2013 [VIDEO]

TITLE_IMAGE

Today was an amazing day for me at the Unite Nordic conference in Malmo, Sweden. I was able to attend the keynote session where Unity CEO David Helgason announced that they are making their mobile tools free to indie developers and small studios!

Unity is a leader in game development with just shy of two million developers using the tools. Now with this announcement, Unity is making it easy for any developer to bring their games to mobile devices – including the BlackBerry Z10 and BlackBerry Q10 smartphones – and the upcoming BlackBerry Q5 smartphone.

At the keynote, David spoke about how, as game developers, we’re just at the inflection point of mobile and how mobile is surpassing other platforms in adoption. There have been many games that have proven that mobile is a profitable platform, but there is much room to grow.

Take a look oat David’s Video Announcement:

Our booth at the conference was bustling with activity. Game developers were intrigued by the BlackBerry 10 platform and we had many conversations on how they could use Unity to get their apps onto the platform.

We encourage you to take advantage of the Unity open beta for BlackBerry 10!

BlackBerry Live 2013 – Interview with Karl and TJ from Dandy [VIDEO]

TITLE_IMAGE

As developers, when we have an idea for app, we can build it. But what if you’re not a developer, but you have the idea for the next great app? Dandy recently launched their beta where people can share their app ideas with the Dandy community and help build an amazing app together. Last week, I spoke with Karl Allen-Muncey and Taylor Jones during BlackBerry Live to talk apps, BlackBerry 10, and building the next great app.

Bluetooth Low Energy on BlackBerry 10 – Cadence and Cascades

I think everyone would agree that living a healthy lifestyle and following a suitable exercise regime is an important factor in keeping well in today’s world. It’s not without its challenges though! How many good intentions have fallen by the way-side? It’s not easy to get yourself out of that comfy chair and head off to the gym, take that walk or get on that bicycle. More often than not the comfy chair wins. At least that’s been my experience. Maybe I have a special, demonic chair or something.  It also tells me to eat cake sometimes. Hmmm.

That said there are…. apparently…. people in this world who have a bit more resolve than I do and take their sporting and fitness activities a bit more seriously. Not only do they manage to get out of the comfy chair, they even like to measure and analyse their performance so they can improve.

Now my colleague Martin (@mdwrim) has normal furniture in his house and seems more than capable of getting out of the comfy chair and down to the climbing wall or out on his bike. He and I (@jcmrim ) talked about the kind of technology available to sporty people, in particular cyclists. Martin had just come back from watching part of the Giro d’Italia and pointed out that all the pro cyclists have sensors on their bikes. BlackBerry 10, Bluetooth Low Energy and cycling! What a perfect combination of great technology, fun and exercise as well as a great opportunity for a new Blog post, video and sample app!

If you haven’t already done so, this is probably a good time to have a read of our previous blog posts and articles on the Internet of Things and Finding Car Keys since they cover the basic concepts needed in this blog post.

As before, the first thing we did was to do a little bit of research to see if the Bluetooth SIG had defined any standards in this area; no point in re-inventing the wheel [no pun intended] and the existence of a standard would mean that a vendor may have already implemented the technology in a product.

Whenever you have a requirement that may be solvable using Bluetooth LE the first place to look is here:
http://developer.bluetooth.org/gatt/Pages/default.aspx
.

Browsing through the GATT Profiles we came upon this one: Cycling Speed and Cadence (CSC)… this sounded promising, and the description looked like it was just what we needed.

“The Cycling Speed and Cadence Profile is used to enable a data collection device to obtain data from a Cycling Speed and Cadence Sensor (CSC Sensor) that exposes the Cycling Speed and Cadence Service.”

The key element of this profile is the Cycling Speed and Cadence Service (UUID 0×1816) which contains four really useful fields:

  • “Cumulative Wheel Revolutions”
  • “Cumulative Crank Revolutions”
  • “Last Wheel Event Time”
  • “Last Crank Event Time”

These are part of the “CSC Measurement” GATT Characteristic (UUID 0x2A5B). They are described in detail here: CSC Characteristics and outlined in Figure 1.

There are some other characteristics that allow configuration and control of the device but we’ll talk about these when we come across them.

TITLE_IMAGE

Figure 1 Key GATT Characteristics for CSC

So, if you think about these characteristics they allow you to derive a number of key measurements:

  1. Total distance travelled – using “Cumulative Wheel Revolutions” – all you need to know is the wheel circumference to calculate this, but if you combine this with a time and a geo-location measurement you can even derive sufficient information to plot your progress on a map.
  2. Speed – using “Last Wheel Event Time” – you can figure out how fast the bike is going if you do a simple calculation involving the time between successive Last Wheel Event Time values and the number of wheel revolutions that occurred in that time. But if you combine this with a geo-location measurement you can derive sufficient information to plot your speed on the map as well.
  3. Instantaneous effort – using ““Last Crank Event Time”” – this can help identify those times that you’re free-wheeling and not expending energy.

It’s at this point that the engineer in me begins to wonder how to instrument a bicycle to make use of this GATT profile. Martin’s a cyclist, so, after identifying a device that matched the requirements (Wahoo Fitness Blue SC[1] device), he attached it to his cycle as shown in Figure 2.

Figure 2 Attachment of cycle monitor

Figure 2 Attachment of cycle monitor

For those of you who are mechanically minded small magnets on both the crank and the rear wheel spokes activate the sensor strapped to the frame. The sensor maintains the counts and timings and will report them to a suitable Bluetooth LE device such as a BlackBerry 10 smartphone.

The application that we developed based on this is actually very similar in structure to the Heart Rate Monitor application that was described in a previous blog and article. The basic logic is the same:

  1. Pair the Bluetooth LE device with the BlackBerry 10 handset before using the application.
  2. Launch the application which:
    1. Discovers devices that support the CSC Service (UUID 0×1816)
    2. Connects to a discovered device selected by the user
    3. Requests the device to notify our application as changes are made to the CSC Measurement characteristic (UUID 0x2A5B) which contains the wheel and crank data that we’re interested in.
    4. Receive, parse and display in numerical (RPM) and historical graphical form the CSC Measurement data as they are received.

Here are some screenshots showing what the application looks like:

Figure 3 The CscMonitor Application

Figure 3 The CscMonitor Application

Instantaneous values of the wheel and crank readings in revolutions per minute (RPM) are shown in the upper part of the screen whilst historical RPM data are plotted on the lower half of the display. Wheel and crank historical data displays can be toggled by touching the screen. Mapping RPM values to distance or energy expended would require additional information to be provided, such as the wheel circumference or radius of the crank — we’ll leave this for a possible later iteration of the application and focus on the Bluetooth LE aspects for now.

If we inspect the GATT services the CSC device supports using a tool like BTool we can see (Figure 4) that the CSC Measurement Characteristic (UUID 0x2A5B) is exposed at handle 0×0023. Handles are the references to entries in the GATT that our application will discover and use to access the value associated with a characteristic. We’ve used handles before in both our previous examples.

Figure 4 GATT showing CSC Characteristics

Figure 4 GATT showing CSC Characteristics

Associated with the CSC Measurement Characteristic is a “Client Characteristic Configuration” characteristic (UUID 0×2902) exposed at handle 0×0024. The value of this field determines whether our application will receive Notifications or Indications for the CSC Measurement Characteristic. We’ve used these before as well in our previous examples. In this case this characteristic will be set to enable Notifications using the BlackBerry 10 Bluetooth LE API.

So, how do we manage the data that is notified to us from the CSC device? The CSC data received is managed by a class called “CscDataContainer” … here’s part of its definition:

class CscDataContainer: public QObject {
       Q_OBJECT
private:
       CscDataContainer();
...
       // notification data
       QQueue<csc_notification_t> _csc_notifications;
       // CSC values
       QQueue<csc_values_t> _csc_values;
       int _min_wheel_rpm;
       int _max_wheel_rpm;
       int _avg_wheel_rpm;
       long _total_wheel_rpm;
...
}

At its core are a couple of queues that maintain the data that is received. The queue has a maximum length that can accommodate one notification per second for an 8 hour period. A future version might persist these data in a database but this is sufficient to demonstrate the principle in this case.

Once again the excellent little JavaScript library called “Flot” is used to plot these data in a WebView component in QML.

As notifications are received by our application the addNotification() method of the CscDataContainer class is called with the CSC Measurement data passed as a (uint8_t *) and a length (uint16_t) — that is an array of bytes.

Parsing this data is the first task and it’s instructive to see how this works – the main points are highlighted in the code fragment below:

void CscDataContainer::addNotification(const uint8_t *val, uint16_t len) {
       // parse value, paying attention to the bit settings in the FLAGS field
       bool wheel_revolution_data_present = false; // bit 0 of Flags field
       bool crank_revolution_data_present = false; // bit 1 of Flags field
       uint32_t cumulative_wheel_revolutions = 0;
       uint16_t cumulative_crank_revolutions = 0;
       uint16_t last_wheel_event_time = 0;
       uint16_t last_crank_event_time = 0;
       int index = 0;
       uint8_t flags = val[index];
       wheel_revolution_data_present = ((
flags & WHEEL_REVOLUTION_DATA_PRESENT) == WHEEL_REVOLUTION_DATA_PRESENT);
       crank_revolution_data_present = ((
flags & CRANK_REVOLUTION_DATA_PRESENT) == CRANK_REVOLUTION_DATA_PRESENT);
       // Fields are in the order of LSO to MSO.
       // Where LSO = Least Significant Octet and MSO = Most Significant Octet.
       index++;
       if (wheel_revolution_data_present) {
              // Cumulative Wheel Revolutions, 4 bytes.
             // Field exists if the key of bit 0 of the Flags field is set to 1.
              cumulative_wheel_revolutions =
(val[index + 3] << 24) | (val[index + 2] << 16) |
(val[index + 1] << 8)  |  val[index];
index += 4;
              // Last Wheel Event Time, 2 bytes. 
              // Field exists if the key of bit 0 of the Flags field is set to 1.
              last_wheel_event_time = (val[index + 1] << 8) | val[index];
              index += 2;
...
}
       if (crank_revolution_data_present) {
// Cumulative Crank Revolutions, 2 bytes. 
// Field exists if the key of bit 1 of the Flags field is set to 1.
              cumulative_crank_revolutions =
(val[index + 1] << 8) | val[index];
              index += 2;
              // Last Crank Event Time, 2 bytes. 
              // Field exists if the key of bit 1 of the Flags field is set to 1.
              last_crank_event_time = (val[index + 1] << 8) | val[index];
              index += 2;
    ...
    }
...
}

The first byte of data contains an 8-bit flag field (see Figure 1 for details). This indicates whether crank or wheel data is present in the following data.  If these are present they are represented in Little-endian form and need to be extracted by shifting them out a byte at a time.

The rest of the application is more focussed on the display of this data using QML so I’ll leave that for you to look at yourself since the main learning points are to do with how to interface to the Bluetooth Low Energy device itself.

We made a video which has Martin (@mdwrim) showing the application in action and explaining the code. Here it is:

If you want to know more then check out the following resources:

I hope you’ve enjoyed this short note and hope it has piqued your interest to find out more about Bluetooth Low Energy and how it can be integrated into your BlackBerry 10 applications.


[1] This should not be regarded as an endorsement by BlackBerry, explicit or implied.

Real-time Communications (VoIP) on BlackBerry 10: WebRTC and Open Peer

I would like take this opportunity and introduce you to our good friends at Hookflash who have successfully ported all major components of both WebRTC and Open Peer libraries to BlackBerry 10. To provide a brief overview, WebRTC is an open source multimedia & network stack that supports real-time audio & video. The value Open Peer delivers to WebRTC applications is peer-to-peer (P2P) signalling on the wire, Instant Messaging, Federated Identities and multiple mobile platform support.

Read More »

How BlackBerry Helped Me Become a BlackBerry 10 Developer [Guest Post]

Guest post from Dragos Filipovici – Adam.

I received the following email earlier this week from developer Dragos Filipovici. He wanted to share his story about an application he recently created for BlackBerry 10.

As I read the email, it was clear to me that his success was due to the strengths of the BlackBerry 10 HTML5/WebWorks platform and the social power of the open source & blog communities.  As such, I wanted to share.

Some of you might already know Dragos online as BglowDragosh. Before getting into BlackBerry 10 app development, he acquired UI design experience in building BlackBerry themes.

TITLE_IMAGE

Hi Adam,

About a year and a half ago I tried app development using the Java SDK. I got stuck in the complex ways to achieve simple tasks (even creating a basic UI), the not always clear documentation, and the long deployment processes for OS5-7 devices. Granted, I was still a newbie in Java. 

However, I was (and still am) a JavaScript newbie as well – 6 months ago when I first started learning web app development. 

I believe the biggest factor helping me successfully transition to BlackBerry 10 app development was played by the new tools available, as nothing helps one learn like applying new knowledge into an actual tangible project, if the tools are available. For me, the WebWorks framework, the rich documentation, the forums and Github repositories, even the way the developer.blackberry.com website is designed, helped me immensely as a very-beginner developer. And all of BlackBerry’s efforts in the past year to engage with developers have kept me going, and the company’s new platform vibe kept me excited. 

After getting to know WebWorks and then bbUI.js, the learning curve for me was made much easier. I’ve often sent in questions in the WebWorks & bbUI.js Github repositories and most often it was my own code errors trying to achieve simple things, but I got helped each time anyway. Now I post actual API bug reports and sometimes request API features, as users request new features from my app. And I love this formed cycle which I believe was, for my personal experience, a recipe for success.

Which brings me to the present:

So far, it took me about 14 weeks of (intense) work on my first WebWorks app. Yesterday, CrackBerry.com review my app, and in several hours Workahol became the #1 top paid app in BlackBerry World. I am overwhelmed with user feedback suggesting new features – which I will endeavor to implement. It’s great that we are able to achieve such diverse functionality and performant UI without even using the Native SDK, and no user has complained so far (by invoking the old web apps < native argument). 

Lastly, if there’s any way I can help – either by speaking about my experience, or to promote this platform, BlackBerry World or the BlackBerry 10 user community in any way, please let me know.  

Sincerely, 

Kind Regards,

Dragos Filipovici (@BglowDragosh)

Sent from my BlackBerry® wireless device

If you get a chance, check out Workahol in BlackBerry World today. Do you have a success story building for BlackBerry? We’d like to hear – let us know in the comments below.

10.1 Times Better Maps in BlackBerry 10

Nation, it’s been a while since we last discussed MapView APIs for BlackBerry 10. This time I am back with some news on critical improvements to the APIs.

Previously, I talked about how to use the MapView APIs to embed your own layers on top of it. While that was nice and very flexible, it still required some work to get basic pins and bubbles going. In BlackBerry 10.1 we have updated the APIs to support push pins and bubbles out of the box. This means you can now use the native APIs such as GeoLocation and MapData to create and manage push pins with custom icons as well as assign a name and description to each that shows up in the bubble.

TITLE_IMAGE

MapView with pins and bubbles

The bubbles can contain a title, a description as well as an action button. Signals are emitted when the text or the action button is tapped by the user so that applications can carry out the right action in that context. Typical actions would be to show more details about the location or starting a turn-by-turn navigation to that location. Oh and before I forget, did I mention that the title and description supports html tags? Yes it does. You can use html tags to format the text or even insert hyperlinks to open webpages.

A bubble with an HTML hyperlink

A bubble with an HTML hyperlink

I guess I have been saving the best for last. One feature that I am really excited about is the ability to set the MapView to follow a specific pin. This is extremely useful if you want to track friends on a map or keep the user always centered on the map. Simply update the coordinates of the followed pin and watch the map automatically move with it. A full sample app can be downloaded from here.

Finally, a big shout-out to our maps team for their hard work – the MapView now has much better performance, faster tile loading and packs the features most of us need. Let’s get to work and put some more maps in our apps. If you missed the session at BlackBerry Jam Americas 2013, please check out the content on-demand – JAM69 - Maps in your Apps.

Signing Off From BlackBerry Live 2013: Wrap-Up and Story Maker of Highlights [VIDEO]

The Developer Relations team is heading home from BlackBerry Jam Americas and BlackBerry Live in Orlando. Thank you to everyone who joined us in Orlando or watched the keynote sessions online with us. Here’s some highlights from the week!

…and here’s a little Story Maker video that our own Melanie Masson put together!

 

BlackBerry Jam 2013 – Interview with Amos Gaynes from Moog

Amos Gaynes from Moog joined me at BlackBerry Jam 2013 to talk music, app development, and their new Animoog app for BlackBerry 10.