68
Developing for the Nokia Asha Software Platform Attila Csipa @achipa SmartDevCon2 Katowice, 14. 09. 2013

Developing For Nokia Asha Devices

  • Upload
    achipa

  • View
    121

  • Download
    4

Embed Size (px)

DESCRIPTION

An introduction to the Nokia Asha platform, it's developer offering, tooling overview a bird's eye view of the UX development options, and finally advices for application development and deployment on resource constrained devices

Citation preview

Page 1: Developing For Nokia Asha Devices

Developing for the Nokia Asha

Software Platform

Attila Csipa @achipaSmartDevCon2Katowice, 14. 09. 2013

Page 2: Developing For Nokia Asha Devices

Contents

What is Nokia Asha

Developer Offering

Java ME apps

Web apps

Nokia Asha UX basics

IDE/Tooling

Nokia IDE for Java

Emulator

Performance optimization

Page 3: Developing For Nokia Asha Devices

Series 40 (which is not Symbian nor S60)

First device in 1999, the Nokia 7110(but don’t worry, Linux is actually 8 years older)

A Coca Cola company delivery truck in Knoxville, 1909.

Page 4: Developing For Nokia Asha Devices

A few years later…

- 1.5 billion devices by January 2012

- 650 million active (plenty of even touch devices)

- Freemium and ads DO work

North London Derby between Arsenal and Tottenham Hotspur at Highbury, 1934

Page 5: Developing For Nokia Asha Devices

But the world changed…

Women on motorcycles in Great Britain, 1930s

Page 6: Developing For Nokia Asha Devices

New Nokia Asha

=Series40 Hardware adaptation

+

Smarterphone middleware

+

Swipe UI

Page 7: Developing For Nokia Asha Devices

Nokia Asha UI

Page 8: Developing For Nokia Asha Devices

HARDWARE KEYS

HIERARCHICAL BACK BUTTON

Page 9: Developing For Nokia Asha Devices

The screen is optimized for mobility, convenience and effectiveness.

Page 10: Developing For Nokia Asha Devices

UX paradigm

The Nokia Asha UX paradigm

Page 11: Developing For Nokia Asha Devices

Building the apps

Construction of the Golden Gate Bridge, San Francisco, 1935.

Page 12: Developing For Nokia Asha Devices

Nokia Asha Developer Offering

Nokia Asha SDK 1.0 (Java ME)

Nokia Asha web app tools 3.0.0

Xpress Web App Builder 1.0

Page 13: Developing For Nokia Asha Devices

One 3rd PARTY app running at a time!

Roger Bannister becomes the first human to run a mile in under 4 minutes. 1954

Page 14: Developing For Nokia Asha Devices

Nokia Asha SDK 1.0

Oracle® based Java ME implementation

New Nokia Public APIs

New emulator

Bundled libraries instead of plugins:

Here Maps for Java ME

Nokia Notifications API

LightWeight UI Toolkit (LWUIT)

Tantalum

On-Device Debugging

Page 15: Developing For Nokia Asha Devices

Nokia Asha Software Platform 1.0the Java ME story

• Java ME MIDP 2.1, CLDC 1.1

• Optional JSRs

• Nokia APIs

• Max JAR file size: 5 Mb

• Max Java Heap: 3 Mb

• Screen Size: 240 x 320

• Series 40 Binary Compatibility

Page 16: Developing For Nokia Asha Devices

Yes, this is a resource constrained environment

Which also means that it rewards GOOD code instead of SLOPPY one

Page 17: Developing For Nokia Asha Devices

JAD Editor

NOKIA IDE FOR JAVA

© 2012 Nokia Asha 2013 technical briefing v1.2 November 14, 2012 Attila Csipa

Device SDK Manager

Integrated SDK + Toolchain

App TemplatesApp Templates

JAD Editor

Page 18: Developing For Nokia Asha Devices

Emulator:The easy/cheap way to practice

Aerial gunnery training, World War I

Page 19: Developing For Nokia Asha Devices

Emulator:What can we do with it?

- Speeds up development cycle

- Use for screenshots!

- Customize input

- Keyboard/touch (pinch)

- Sensors (accelerometers, network, location)

- Multimedia (webcam)

- Content is at -C:\Nokia\Devices\Nokia_Asha_SDK_1_0\bin\Storage\10000

- Needs emulator restart if filesystem updated directly

- The number will increase (10002, etc) if multiple simultaneous emulators run

Page 20: Developing For Nokia Asha Devices

On Device Debugging – for the nastiest bugs

From Harvard Mark II electromechanical computer's log, featuring a dead moth:the first bug, 66 years ago

Page 21: Developing For Nokia Asha Devices

The joy of the first successful run

Annie Edison TaylorThe first person to survive going over Niagara Falls in a barrel, in 1901

Page 22: Developing For Nokia Asha Devices

23

© Nokia 2013 LCDUI and LWUIT UI components in Nokia Asha.pptx v.1 2013-05-28 Jan Krebber

THE VISUALIZATION CHANGED, BUT THE APIS REMAIN LARGELY COMPATIBLE.

Page 23: Developing For Nokia Asha Devices

Platform approach

Over-the-air push-style updates

New SDK manager

Independent API/library updates

Full binary compatibility from Asha 1.0+

Page 24: Developing For Nokia Asha Devices

API offering: extending the platform

CLDC 1.1 (JSR-139)

MIDP 2.1(JSR-118)

File Connection and PIM API(JSR-75)

Bluetooth and OBEX API

(JSR-82)

Wireless Messaging API 1.0

(JSR-120)

Wireless Messaging API 2.0

(JSR-205)

Mobile Media API (JSR-135)

Web Services API (JSR-172)

SATSA-CRYPTO API (JSR-177)

Location API (JSR-179)

Mobile 3D Graphics API v1.0

(JSR-184)

Content Handler API (JSR-211)

Scalable Vector Graphics API

(JSR-226)

Advanced Multimedia

Supplements (JSR-234)

Mobile Sensor API (JSR-256)

com.nokia.mid.media

com.nokia.mid.uicom.nokia.mid.ui

frameanimator

com.nokia.mid.ui

gestures

com.nokia.mid.ui

locale

com.nokia.mid.ui

orientation

com.nokia.mid.uicategorybar

Mobile Internationalization

(JSR-238)File Select API

Image Scaling API Network State API Phone Info API Contact APINokia Notification

API (NNA)Nokia In-App

Payment

Page 25: Developing For Nokia Asha Devices

New Nokia Asha Java APIs

ContactFile selectNetwork state Phone settings

Moving from Service APIs to a PUBLIC PLATFORM OFFERING

Page 26: Developing For Nokia Asha Devices

What if your app is not running/awake?

Before alarm clocks were affordable,'knocker-ups' were used to wake people early in the morning.

UK, around 1900

Page 27: Developing For Nokia Asha Devices

Nokia Notifications API - NNA

Public API

Push notification service

Shared connection

Custom payload

Page 28: Developing For Nokia Asha Devices

Nokia in-app payment

Device range

Reach

Security

Simplicity

Sign up to the invitational beta: http://developer.nokia.com/Distribute/In-app_payment/

Page 29: Developing For Nokia Asha Devices

Largest range of devices

Page 30: Developing For Nokia Asha Devices

Broadest reach

• Operator billing live with

- 158 operators

- in 59 countries

Live Operators

■ Full Country coverage

■ Partial Country coverage (status in April 2013)

Page 31: Developing For Nokia Asha Devices

Internationalization – JSR238

• Strings AND binary data

• Format data (date, currency)

• Compare

• Sort

Page 32: Developing For Nokia Asha Devices

33

© Nokia 2013 LCDUI and LWUIT UI components in Nokia Asha.pptx v.1 2013-05-28 Jan Krebber

THE VISUALIZATION CHANGED, BUT THE APIS REMAIN COMPATIBLE.

Page 33: Developing For Nokia Asha Devices

Java UI development approaches

Canvas LCDUI LWUIT

Page 34: Developing For Nokia Asha Devices

Canvas

Completely custom

You OWN every pixel

Fastest

Best suited for games

Page 35: Developing For Nokia Asha Devices

The key is a native look and feel

36© 2013 Nokia DevelopingForTheNewAshaPlatform.pptx v. 0.2 2013-04-20 Attila Csipa

Page 36: Developing For Nokia Asha Devices

LCDUI

Page 37: Developing For Nokia Asha Devices

LCDUI

High-level components

Nokia UI API

Asha look & feel

No customizability

(except CustomItem)

Page 38: Developing For Nokia Asha Devices

LCDUI is based on few view types

39

© Nokia 2013 LCDUI and LWUIT UI components in Nokia Asha.pptx v.1 2013-05-28 Jan Krebber

Displayable

ScreenCanvas

With chrome Full screen Alert List Form TextBox

ChoiceGroup

DateField

TextField

Gauge StringItem

ImageItem

CustomItem

Spacer

Implicit choice Exclusive choice Multiple choice

Page 39: Developing For Nokia Asha Devices

LWUIT

More components

More customization

Asha look and feel

Animated

Custom theming

(branded look and feel)

Page 40: Developing For Nokia Asha Devices

LWUIT for Nokia Asha Software Platform 1.0

• New port of LWUIT, targeting specifically new Asha platform

• Based on the LWUIT for Series 40 v1.0

• Adds Nokia Asha Software Platform 1.0 Theme

• Adds 8 new components

• Changes and adaptations of existing components to new Asha platform

• Improved performance especially in themes memory usage.

• 24 Examples in SDK

• Double-check you’re including the right JAR!

Page 41: Developing For Nokia Asha Devices

Nokia Asha web apps - Tools

Xpress-Browser powered

Requires a data connection

Web apps != HTML5 (!!!)

Nokia Asha web app tools 3.0

Backwards compatible with Series 40 web apps

Simulator support for Nokia Asha 1.0 devices

USB deployment of web apps on Nokia Asha 1.0 devices

Page 42: Developing For Nokia Asha Devices

TESTING IS BEST DONE ON (SOMEBODY ELSE‘S) DEVICE

Testing a bullet proof vest c.1923

Page 43: Developing For Nokia Asha Devices

Remote Device Access

• Free for Nokia Developer users

• Deploy & Test apps

www.developer.nokia.com/Devices/Remote_device_access/

• Now with the Asha 501(s)!

Page 44: Developing For Nokia Asha Devices

Performance optimization

A bicycle with 12 rockets mounted on the back wheel. ~1930s

Page 45: Developing For Nokia Asha Devices

Why Optimize

Most of the development tasks for the typical mobile application can be done in many different ways.

Different implementation techniques lead to different application performance and essentially different responsiveness of user interface.

Responsiveness of UI is one of the important factors for application success.

Page 46: Developing For Nokia Asha Devices

• 0.1 second is about the limit for having the user feel that the system is

reacting instantaneously, meaning that no special feedback is necessary except to display the result.

• 1.0 second is about the limit for the user's flow of thought to stay

uninterrupted, even though the user will notice the delay. Normally, no special feedback is necessary during delays of more than 0.1 but less than 1.0 second, but the user does lose the feeling of operating directly on the data.

• 10 seconds is about the limit for keeping the user's attention focused on

the dialogue. For longer delays, users will want to perform other tasks while waiting for the computer to finish, so they should be given feedback indicating when the computer expects to be done. Feedback during the delay is especially important if the response time is likely to be highly variable, since users will then not know what to expect.

Miller, R. B. (1968)Response time in man-computer conversational transactions. Proc. AFIPS Fall Joint Computer Conference Vol. 33, 267-277

Page 47: Developing For Nokia Asha Devices

User Experience Studies

Helmet test, ca 1912

Page 48: Developing For Nokia Asha Devices

Can looks deceive?

Page 49: Developing For Nokia Asha Devices

Can looks deceive?

Page 50: Developing For Nokia Asha Devices

THINGS ARE AS YOU PERCEIVE THEM

Page 51: Developing For Nokia Asha Devices

Resource constrained environments

Cheese “sandwich” served on the Sao Paolo – Manaus TAM flight

Page 52: Developing For Nokia Asha Devices

Perception of speed

• Responsiveness – what you believe is more important than what you actually see

• Visual updates to acknowledge input

• Draw when you can, not when ready

• Speed != throughput

Page 53: Developing For Nokia Asha Devices

Parallelize! (concurrency)

• 1 core != 1 system

• Threading is needed to unleash maximum potential

• You need to do it Right TM

• Typical failure to do so: slow, unresponsive Uis

• On Ashas, you will want 4-5 threads, depending on use-case

Page 54: Developing For Nokia Asha Devices

Threading pitfalls

- Too many long running threads

- Hard to debug

- Complexity

The last four couples standing in a dance marathon. Chicago, c. 1930

Page 55: Developing For Nokia Asha Devices

NETWORK operation feedback

• Feedback throughout the download cycle

• (but we can do even better!)

Page 56: Developing For Nokia Asha Devices

NETWORK operation feedback

• User feedback throughout the DL

• GET -> DOWNLOAD -> PARSE -> CACHE WRITE

Page 57: Developing For Nokia Asha Devices

File io: make it a habit

Write files as you go

…in a Worker thread…

…flush occasionally...

…don’t do it byte by byte

(do outputStream.write(byte[] buffer)

Don’t wait for it to pile up (especially for cases of destroyApp())

Page 58: Developing For Nokia Asha Devices

That pesky 5mb jar size limit

• Obfuscate. Always.• Reduce image quality/size• Use large(r) images and clip them (w Sprite class)• Keep text strings in separate files – they compress better• Keep data in RMS

• Treat your store JAR as an online installer (runs on it’s own, maybe bundle with first few levels, download rest as needed)

• Silver lining:Small JARs mean less failed DLsUser gets to interact with your app sooner

Page 59: Developing For Nokia Asha Devices

Architecture Changes

• Carefully consider architecture of your drawing loop and user input loops and decouple them whenever possible.

• Explore WeakReference introduced in CLDC 1.1 for memory management.

Page 60: Developing For Nokia Asha Devices

How much memory do we REALLY need?

• 1024 items

• 1KB per item

• Minimum memory required: 1MB

8KB!

Page 61: Developing For Nokia Asha Devices

WeakReference object Caching

• Best pattern for using all available heap memory, but never running into the dreaded OutOfMemoryError.

• CLDC 1.1 WeakReference

• When an object is referenced by a WeakReference, and not using traditional Object pointers, this is a signal to the garbage collector that is has permission to collect the object if memory is running low.

• You have to maintain own HashTable of Objects

• To understand this pattern better look at Tantalum Mobile: • https://github.com/TantalumMobile/

Page 62: Developing For Nokia Asha Devices

Treat the garbage collector as a friend, not as a slave

• Pay attention to scoping

• Set variables to null manually when they are no longer needed

• Be careful with hidden references (inner classes on EDT or workers)

• If you are calling System.gc(), you’re doing it wrong

Page 63: Developing For Nokia Asha Devices

Render Caching

• One of the common performance needs is to make your application paint, in particular scroll, smoothly and quickly.

• You can paint items each into their own Image, keeping that pre-painted Image in a cache, and reusing it as the object moves around the screen. Essentially, WeakReference cache of pre-painted Images.

• To understand this pattern better look at Tantalum Mobile:

• http://projects.developer.nokia.com/Tantalum

Page 64: Developing For Nokia Asha Devices

File System (Flash Memory) Caching

• Flash memory is slow, but faster then Web.

• Cache downloaded data from previous session. Improve startup time of app, by loading from disk cache instead of new Web requests.

• RMS and File System (JSR-75) same speed, but with RMS no security prompts.

• Underwater stones: still remember, Flash memory is slow.

• Architect your application to use asynchronous loading /saving of data from / to disk cache.

Page 65: Developing For Nokia Asha Devices

Performance summary

•Work with your interaction designer to find and/or make cheat zones

−Hide activity not just behind splash screens, but also dialogs, alerts

−Predict user activity to appear “instant-ready”

Page 66: Developing For Nokia Asha Devices

Summary

• Huge untapped market, plenty of devices even if you count only touch enabled ones

• (Surprisingly?) Java ME with Canvas, LCDUI or LWUIT UIs paired with a reasonable amount of APIs allows for rich functionality

• Coding for Asha will make you more aware of resources, UX, and thus make you a better developer for all the other platforms, too

Page 67: Developing For Nokia Asha Devices

http://developer.nokia.com

Nokia developer resources

Page 68: Developing For Nokia Asha Devices

Thank you!

Questions?

Attila Csipa@achipa

All images were from @HistoricalPics or WikiMedia Commons under CC BY-SA