moosecon - @KLAJLI & @ARDIRI
BlackBerry 1
Native Application (C/C++) development on BlackBerry 10 Aaron Ardiri [email protected]
twitter: @ARDIRI
Kamel Lajili [email protected]
twitter: @KLAJILI
SO, WHAT IS
EXACTLY?
moosecon - @KLAJLI & @ARDIRI
BlackBerry 2
• cinematic experience • multi-tasking as second nature • content is king • fluid workflow • moments of charm
http://developer.blackberry.com/ui
BlackBerry 10
BLACKBERRY 10 DEMO
moosecon - @KLAJLI & @ARDIRI
BlackBerry 3
APPLICATION DEVELOPMENT AND TOOLCHAINS
BlackBerry 10
C++/Qt Cascades
ActionScript Adobe® AIR®
HTML5 BlackBerry® WebWorks™
C/C++ Native SDK
Java Android™ Runtime
moosecon - @KLAJLI & @ARDIRI
BlackBerry 4
BlackBerry 10 SDK Platform Support
THE QNX NEUTRINO RTOS
moosecon - @KLAJLI & @ARDIRI
BlackBerry 5
!"#$%&'()*#+,#*-()-*-./+
• 0&1#*+2&3+0&$.+45#$+(6(-*()*#+.&1(/+
7 8-'1&9$:;+<-'"=:;+>'13&-1?+
• 45+@&'.(-'$+.3#0#'1&"$+(0&"'.+&2++2"'@%&'(*-./+9-.A+"'3#$.3-@.#1+BCD+E3-6-*#F#$++
• (+2("*.+-'+&'#+45+@&0E&'#'.+@('+1(0(F#++('/+&.A#3;+*#(1-'F+.&+$/$.#0G9-1#+@&33"E%&'+
7 $/$.#0+3#*-()-*-./+-$+($+F&&1+($+/&"3+9&3$.+13-6#3+1#6#*&E#3+
7 3#)&&.+-$+&'*/+3#@&6#3/+E&$$-)*#+
!""# !""#
!""#!""#
$%"&'#()*+,)#
-*.,#/0/',1#
2)*+,)#3,'45)6#/'786#
95%5.*':*8##;<#
!""# !""#
9&.=1,(*7#/'786#
Operating Systems Monolithic Architecture
H-$$-&'+B3-%@(*+,#*-()-*-./+
• 0-@3&I#3'#*+0-'-0-J#$+#=#@"%&'+9-.A++"'3#$.3-@.#1+KI#3'#*L+BCD+E3-6-*#F#$+
• (**+E3&@#$$#$+3"'+-'+-$&*(.#1+E3&@#$$+$E(@#+
7 -'@*"1#$+13-6#3$;+M*#+$/$.#0$;+$.(@I$+
7 (**+!NO+E3&@#$$#$+(3#+K(EE*-@(%&'$L+
• 2("*.$+(3#+@&'.(-'#1+$&+.A(.+.A#/+&'*/++(P#@.+.A#+2("*./+@&0E&'#'.+
7 2(-*#1+@&0E&'#'.$+@('+)#+1/'(0-@(**/+3#@&6#3#1+9A-*#+.A#+$/$.#0+@&'%'"#$+.&+&E#3(.#+
!""# !""#
!""#!""#
$%"&'#()*+,)#
-*.,#/0/',1#
2)*+,)#3,'45)6#/'786#
H-@3&G+I#3'#*++
!""# !""#
9&.=1,(*7#/'786#
Operating Systems MicroKernel Architecture
moosecon - @KLAJLI & @ARDIRI
BlackBerry 6
• 0-@3&I#3'#*+A($+.A#+$0(**#$.+(0&"'.+&2+@&1#+9-.A+BCD+E3-6-*#F#$+
• @&1#+-$+0&3#+#($-*/+3#6-#9#1++('1+$@3"%'-J#1+1"#+.&+-.$+$-J#+
• )"FF/+)#A(6-&3+-$+2&"'1+('1+#*-0-'(.#1+)#2&3#+E3&1"@.+3#(@A#$+@&'$"0#3$Q+A('1$+
• 3-$I+&2+$/$.#0+2(-*"3#+-$+*&9+
Millions of lines of kernel code
Linux (Android) 12
XP 40+
Linux (Generic) 14
WinCE 3.9
QNX 0.1
Operating Systems Kernel Sizes (Lines of Code)
Operating Systems Kernel Architecture Comparisons
moosecon - @KLAJLI & @ARDIRI
BlackBerry 7
3&8.,7)#>,78'5)/#
?7),:5&/,#@5%')5.#
9*%*%A#@5%')5.# @7%7(7)1#B*/*5%#
?7.17)'#CB!@#
?*%(1*../# 95'5)#@5%')5.# DE@F/# D)58,//#@5%')5.#@7%8,)#G:,)7"0#
E7/,)#H0,#<&)A,)0# D),8*/*5%#9*..*%A#
QNX: Proof of Stability Mission Critical Reliability
BB10 APPLICATION GUIDELINES
moosecon - @KLAJLI & @ARDIRI
BlackBerry 8
Application Guidelines
• respond correctly to lifecycle events
• failure to do so can: • drain battery • interfere with other apps
Start
Exit
Normal (Active)
Thumbnail (Active/Inactive)
Hidden (Inactive)
application lifecycle
applications can integrate with the operating system and other core applications by using:
• BBM Framework, • Share Framework, • PIM APIs, • Universal Search, • Push Service, • Payment Service, • Advertisement Service • Balance
Application Guidelines
Integrated Social Beautiful
moosecon - @KLAJLI & @ARDIRI
BlackBerry 9
applications can use the Invocation Framework to minimize “reinventing the wheel” and improve the user’s flow:
• cards and content viewers • launching core and 3rd party Apps • registering URIs and MIME types
Application Guidelines
Bound Invocation
I want Dr. Doc to open this .doc
file.
I can open .doc
files
Invocation Framework Dr. Doc
moosecon - @KLAJLI & @ARDIRI
BlackBerry 10
Unbound Invocation
I need to open this .doc file.
Anyone?
I can open .doc
files
I can open .doc
files
I can open .png
files
Invocation Framework
Cards
! embeds a screen from target ! instead of launching the full app
! no App Grid presence ! supports peeking
! a leap ahead of the competition ! BlackBerry 10 Flow at its best!
! invoked in the same way!
moosecon - @KLAJLI & @ARDIRI
BlackBerry 11
Card Styles
! Three styles ! Composer ! Previewer ! Picker
! Determines ! Peek behavior ! Transition style
Application Packaging
data
logs
tmp
app
shared
Sandbox
Application Installation
User Shared
• cannot directly access files of other applications
• use the development mode to see your application sandbox
• only place user visible files (across device) in shared area
moosecon - @KLAJLI & @ARDIRI
BlackBerry 12
Application need to request resource access in the bar-descriptor.xml file
Application Signing
BAR
Request RIM Signature
Sign with Developer Certificate
Signed BAR
Half Signed BAR
moosecon - @KLAJLI & @ARDIRI
BlackBerry 13
Native Runtime
AIR Runtime
Android Player
Web Runtime
BlackBerry 10 Foundations Platform APIs & Core Packages
System Service
OS
Application Infrastructure
Application Platform Payment
Invocation
Advertising
Share Calendar
Push Data
Contacts
Notification
Messages
Phone
Tasks
BBM™ Service
…
Lifecycle
Configuration
Utilities
Cascades
Backup / Restore i18n
Search
Instrument’n
Config Balance
…
Navigator Installer Launcher Authentication Multimedia SQLite NFC
Memory Management
Process Management
Power Management IPC File System Device
Drivers …
Window Manager WebKit Protocols Network DRM Crypto …
NATIVE SDK
moosecon - @KLAJLI & @ARDIRI
BlackBerry 14
Native SDK OSS & Developer Experience
#include <stdio.h>!#include <stdlib.h>!
int !main(int argc, char **argv)!{! fprintf(stdout, “Hello World!\n”);! return EXIT_SUCCESS;!}!
Native SDK Hello World
moosecon - @KLAJLI & @ARDIRI
BlackBerry 15
Native SDK BlackBerry Platform Services the BlackBerry Platform Services (BPS) library provides an application with a single consistent interface to a number of different services during the execution of the application.
• universal event management • user interaction/navigator • input/output (sensors, audio, LED, screen, multimedia) • device information, locale and payment services • network status and geo-location
Native SDK BlackBerry Platform Services bps_event_t *event_bps;!
event_bps = NULL;!bps_get_event(&event_bps, timeout); // -1, forever!if (event_bps != NULL)!{! event_domain = bps_event_get_domain(event_bps);! if (event_domain == xxx)! {! // request event information within the domain! }!}!
moosecon - @KLAJLI & @ARDIRI
BlackBerry 16
Native SDK BlackBerry Platform Services handling {service} events
!{service}_request_events({param}); // request events
then capture the appropriate {service} events!
event_domain = bps_event_get_domain(event_bps);! if (event_domain == {service}_get_domain())! {! // handle the {service} event
Native SDK Open Industry Standards
moosecon - @KLAJLI & @ARDIRI
BlackBerry 17
Native SDK Open Source Support
CASCADES SDK
moosecon - @KLAJLI & @ARDIRI
BlackBerry 18
Cascades SDK OSS & Developer Experience
Mature C++ application framework
Good APIs
Signals and Slots
Many help classes
QML
QtGui Cascades
moosecon - @KLAJLI & @ARDIRI
BlackBerry 19
BLACKBERRY 10 CASCADES DEMO
import bb.cascades 1.0
Page { content: Label { text: "Hello World" } }
Cascades SDK Hello World
moosecon - @KLAJLI & @ARDIRI
BlackBerry 20
Page* root = new Page; Label* label = Label::create() .text("Hello World"); root->setContent(label); Application::instance()->setScene(root);
Cascades SDK Hello World
60 FPS!
moosecon - @KLAJLI & @ARDIRI
BlackBerry 21
App logic
Photos by rumpleteaser and whologwy Flickr
Cascades
UI in separate thread 28°
Scene Graph
Root Container
Text: “Hello World”
Container
Hello World
RotationZ Scale Opacity
moosecon - @KLAJLI & @ARDIRI
BlackBerry 22
R6#'.$+
Qt uses signals & slots paradigm
Cascades events are mapped to Qt signals
S('1*-'F+T&"@A+R6#'.$+-'+!H<+
Container { onTouch: { if (event.isDown()) { scaleX = 2; scaleY = 2; rotationZ = 45; } else if (event.isUp()){ scaleX = 1; scaleY = 1; rotationZ = 0; } } }+
moosecon - @KLAJLI & @ARDIRI
BlackBerry 23
S('1*-'F+T&"@A+R6#'.$+-'+BUU+
QObject::connect(bubble,SIGNAL (touch(bb::cascades::TouchEvent*)) this,SLOT (touched(bb::cascades::TouchEvent*)) );
touched(bb::cascades::TouchEvent *t) { if (t->isDown()) { bubble->setScale(2f); bubble->setRotation(45.0f); } else if (t->isUp()) { bubble->setScale(1f); bubble->setRotation(0.0f); } } }
You can choose!
No difference between UI created in QML or C++
They can be combined Typically, UI in QML and business logic in C++
QML supports JavaScript for signal handling
C++ QML
moosecon - @KLAJLI & @ARDIRI
BlackBerry 24
>'-0(%&'$+
Any Cascades UI element can be animated
Animations are “running” on the engine thread Remember the client server setup?
Explicit & Implicit animations: translation, rotation, scale, opacity, …
Core Controls
moosecon - @KLAJLI & @ARDIRI
BlackBerry 25
B"$.&0+B&'.3&*$
Container DockLayout
SpeedGauge
RotationZ (-0) RotationZ (-40) TranslationY (30)
TranslationY(30)
Custom list items
moosecon - @KLAJLI & @ARDIRI
BlackBerry 26
Data Binding
SQL
XML
JSON
Anything
StackLayout & DockLayout
moosecon - @KLAJLI & @ARDIRI
BlackBerry 27
Pages, Panes and Navigation
UI Guidelines
developer.blackberry.com/ui
moosecon - @KLAJLI & @ARDIRI
BlackBerry 28
Thank You Aaron Ardiri [email protected]
twitter: @ARDIRI
Kamel Lajili [email protected]
twitter: @KLAJILI