Find file
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (69 sloc) 2.76 KB

BlackBerry 10 port of the Localytics instrumentation classes

Localytics does not currently provide an instrumentation library for BlackBerry 10. This project is a port of the iOS library.



How to instrument your Qt app


In yourapp.cpp:

void YourApp::onStart()
    LocalyticsSession *s = LocalyticsSession::sharedLocalyticsSession();

// This is analog to iOS's "app was backgrounded"
void YourApp::thumbnail()

// Analagous to "app was brought back to foreground"
void YourApp::fullscreen()
void YourApp::aboutToQuit()

in your class that extends bb::cascades::application.

Also, connect these signals in main.cpp:

Q_DECL_EXPORT int main(int argc, char **argv)
    YourApp mainApp;
    QObject::connect(&app, SIGNAL(thumbnail()), &mainApp, SLOT(thumbnail()));
    QObject::connect(&app, SIGNAL(fullscreen()), &mainApp, SLOT(fullscreen()));
    QObject::connect(&app, SIGNAL(aboutToQuit()), &mainApp, SLOT(aboutToQuit()));
    return Application::exec();

Tagging events (optional)

To tag an event, use the following line of code:

You can attach attributes to an event by passing a Dictionary as a second argument to TagEvent(). For example, to collect information about unhandled exceptions, you could use the following code:

    QVariantMap attr;
    attr["Barcode Length"] = QString::number(barcode_truncated.length());
    LocalyticsSession::sharedLocalyticsSession()->tagEvent("Barcode Added", attr);


  • Screen flows are not currently supported.
  • I haven't found a great way to get the BlackBerry 10 OS version. There have only been a few betas, so this hasn't been an issue yet.
  • The Device UDID relies on the "read_device_identifying_information" permission. Make sure to add it to your "bar-descriptor.xml".
  • Many things are ported from the iOS version. Please pardon any reminants of Objective-C in these sources.


  • Thanks to localytics-win8 for documenting more of the Localytics API and keys, and providing a good markdown template for a README
  • Thanks to qjson for providing a good product structure, including QTest unit tests and cmake examples.
  • Thanks to RIM for producing BlackBerry 10!