building native apps on blackberry...

58
Building Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant Developer Relations Jan 14 th , 2013

Upload: others

Post on 23-Jan-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Building Native Apps on BlackBerry 10

Shadab Rashid Application Development Consultant Developer Relations

Jan 14th, 2013

Page 2: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Agenda

BlackBerry 10 Overview

Native/Cascades Development

Resources / Getting started

Lots of Sample apps

Q&A

Page 3: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Integrated Social Beautiful

Page 4: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Beautiful Flow

Page 5: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Social Connected Apps

Share Framework

Page 6: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Integrated Unified Inbox

Page 7: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

7 January 14, 2013

Peek from wherever you are

Content always on the foreground

Active thumbnails showing app

context

7

Page 8: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

8 January 14, 2013

Lets you type fast with just one finger

Predicts the next letter, with the entire

word

Just swipe up on the letter to finish the

word

8

Page 9: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

9 January 14, 2013

No more odd expressions or

awkward retakes

No more eyes closed!

9

Page 10: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Roads to BlackBerry 10 Development

HTML5 BlackBerry®

WebWorks™

C/C++

Native SDK C++/Qt

Cascades

Page 11: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Open standards

11

Very easy to port C/C++

Platform libraries built on open standards

POSIX and STL friendly (stdc++, socket, pthread, etc.)

Page 12: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Open Standards (2)

12

POSIX and STL

C++,Sockets (libstdc++, libsockets)

OpenGL ES 1.1 / 2.0 (libEGL, libGLESv1_CM, libGLESv2)

OpenAL 1.1 (libOpenAL, libalut)

Imaging (libpng, libjpeg)

Compression (libz, libbz2)

Fonts (libfreetype)

Math (libm)

XML (libxml2, libxslt)

Database (libsqlite)

Page 13: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Development Tools

• Supports Windows, Mac OS X, Linux

• GCC 4.6.3 based compiler tool chain

• GDB 7.3 debugging

• Device Deployment Tools

• VMware Simulator Images

• Eclipse CDT 8 based IDE (QNX Momentics)

13

Page 14: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

BlackBerry 10 Overview

14

Page 15: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Zooming in on the NDK…

15

QNX

• Posix compatible

• C-APIs

• BPS event model

• Low Level Platform APIs

• Core open source libraries and standards

Page 16: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Zooming in on the NDK…

16

Open Source libraries

• Many already ported to QNX

• http://blackberry.github.com/ndk

• …and more getting contributed

Page 17: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Zooming in on the NDK…

17

Game platforms already ported to QNX

• ScoreLoop

• Unity

• Marmalade

• GameLoft

Page 18: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Zooming in on the NDK…

18

This part of the NDK is already available on PlayBook!

• http://developer.blackberry.com/native

Page 19: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Native/Cascades Development

C++/Qt

Cascades

C/C++

Native SDK

Page 20: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Cascades in the native SDK

Page 21: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

The NDK – Two layers

High Level – Cascades

High level APIs / C++

Qt, QML, JavaScript

Built-in Elegance, beautiful UI

Provides the BlackBerry 10 UX

Visual tooling

Low Level – C API

Posix/Low level C; great for porting

Raw OS access, windowing, etc.

OpenGL ES, OpenAL, ...Excellent for games

Great for Open Source Integration 21

Page 22: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Why Use Cascades?

Elegant UI Framework • Great looking core UI components

• Easy to build custom UI components

• Dedicated UI tooling including design

preview (w/ Photoshop Plugin)

Increase Productivity • Higher level APIs

• QT flavoured C++ and declarative UI

approach

Page 23: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Cascades & Qt

• Mature C++ application framework

• Great APIs

• Signals and Slots

• Many helper classes

• QML

Page 24: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Cascades and QT What’s the deal?

Cascades uses QT to provide plumbing and high level services

Object and event models

Markup parser (QtDeclarative)

Signals/Slots (i.e. callbacks)

Core services (e.g: XML-parsing, SQL libs.. Many more)

Cascades does not use QtGui or QtQuick

BlackBerry 10 has it’s own UI framework and roadmap

QtQuick QML != Cascades QML

24

Page 25: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Define the UI in QML

import bb.cascades 1.0

Page {

content:

Label {

text: "Hello World!"

}

}

It's like HTML and JSON

had a baby.

Page 26: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Add some formatting

import bb.cascades 1.0

Page {

content:

Label {

text: "Hello World!"

horizontalAlignment: HorizontalAlignment.center

}

}

This looks a bit like CSS. Only not.

Page 27: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Add some JavaScript! import bb.cascades 1.0

Page {

Container {

Label {

id: hello

text: "Hello World!"

horizontalAlignment: HorizontalAlignment.center

}

Button {

text: "German-ize"

onClicked: {

hello.text = "Hallo Welt!";

}

}

}

}

Finally!

Page 28: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Declarative QML

QML = Qt Modeling Language

QML can:

1. Used by UI designers

2. Rapid prototype UI

3. Do white label/ branding/promotions of applications (with different QML files)

28

import bb.cascades 1.0

Page {

content:

Label {

text: “Hello word!”

}

}

(Simple QML designed to create a Hello World page)

Page 29: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

QML – more than just layout

29

Button {

text: "Expand"

maxWidth: 200

onClicked: {

if (text == "Expand") {

text = "Contract"

maxWidth = 400

} else {

text = "Expand"

maxWidth = 200

} // else

}

} // Button

Embeddable JavaScript!

No need to reinvent the wheel

Do more than just markup in QML

Use separate JS files, create functions, handle signals

Page 30: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Declarative QML (1)

30

Objects

Properties

Arrays (also properties)

JavaScript functions (also properties)

Page 31: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

QML Visual Tooling

QML editor with syntax highlighting/

code completion

Component library

(Drag and drop to QML)

QML design view

QML tree view,

QML properties view

Page 32: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

C++ and QML – A two way street.

32

C++ code can load QML files and access QML objects.

QML files can reference C++ values and objects

Everyone is happy

Page 33: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Invoking C++ from QML

33

Page 34: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Which layer for what?

34

For UI – QML

C++ for application logic (QtCore based)

C and BPS to access system features

Our github repo for popular frameworks and libs

github.com/blackberry

Page 35: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

C++/Qt with C API – an example

35

Qt Signals

Page 36: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Standard UI Components

36

Page 37: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

UI Framework

37

Page 38: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

UI Framework (2)

38

Page 39: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

UI Framework (3)

39

Demo time:

Cascades Cookbook,

Cross fade, Poem

Maker

Page 40: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Invocation framework, BBM

40

Page 41: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Invocation, Flow, Share

Invoke other apps from your own!

Flow seamlessly between applications

Provide that awesome experience

Embed other apps (“viewers”) in your own!

Example: Just want to play a media file?

Just Invoke the media previewer!

41

Page 42: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Unbound Invocation

42

I need to open this .doc file.

Anyone?

I can open .doc files

I can open .jpeg files

I am good for noting

Invocation Framework

Page 43: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Bound Invocation

43

I want Dr. Doc to open this .doc

file.

I can open .doc files

Invocation Framework Dr. Doc

Page 44: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

BBM Framework

Increased discoverability:

Reach over 45 million users worldwide!

Increased engagement and app stickiness:

Get the addicting social element!

Share / download between users, engage friends

Increased monetization:

viral BBM discoverability + increased engagement = Richer developers

44

Page 45: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Storage, App Sandbox, Languages

45

Page 46: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Database Support

Cascades supports both:

QtSql

libsql

Easiest to use QtSql in a Cascades app, provided by QtCore

46

Page 47: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

QtSql Code Sample

47

QString dbPath = "data/db.db";

QSqlDatabase database

QSqlDatabase::addDatabase("QSQLITE");

database.setDatabaseName(dbPath);

database.open();

QSqlQuery query(database);

query.prepare("SELECT * FROM table");

query.exec();

Page 48: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Screen, Multimedia

48

some

multimedia

samples!

Page 49: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Image, Camera, Notifications

49

Page 50: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Location, Sensors, Networking

50

Page 51: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Sensor Subsystems Available

GPS

Accelerometer

Gyroscope

Magnetometer

NFC

Bluetooth

USB

51

Custom Map

View

Page 52: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Where do you Start?

https://developer.blackberry.com/

Page 53: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Getting Started 4 Easy Steps!

Download the Native SDK

53

Create a new Hello World app and

deploy it to your device

Run the getting started wizard

Window -> Preferences -> BlackBerry

Sets up your environment, keys, debug token

Register for Signing Keys

developer.blackberry.com/native

Page 55: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

youtube.com/blackberrydev

Page 56: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Lots of sample apps!

Page 57: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

UX Trumps all!

UX Guidelines For BlackBerry 10

Key Principles

A Cinematic Experience

Multitasking as 2nd nature

Content is king

Fluid Workflow

Moments of Charm

One last app:

Quotes

Page 58: Building Native Apps on BlackBerry 10rtholmes/teaching/2013winter/cs446/slides/SE2_04_BB10-Native.pdfBuilding Native Apps on BlackBerry 10 Shadab Rashid Application Development Consultant

Thanks

Shadab Rashid Application Development Consultant Developer Relations

@surashid

[email protected]

58