Top Banner
INTRODUCTION TO NOKIA ASHA SOFTWARE PLATFORM 1.0 Michael Samarin Director, Developer Training and Evangelism Futurice @MichaelSamarin
42

Introduction to Nokia Asha software platform 1.0

Jan 12, 2015

Download

Technology

Nokia Developer

This webinar introduces Nokia Asha software platform 1.0 and what’s new for developers targeting the Nokia Asha 501 phone. It covers the updates to the development tools and the new APIs for Nokia Notifications, Image Scaling, Image Processing, Gestures, and File Dialog. After providing an overview to what’s new, Java™ expert Michael Samarin of Futurice provides coding demonstrations to show how to use the new features to build great apps.

Join the sessions:

14 May - 7 a.m. New York; noon London; 7 p.m. Singapore: http://forumnokia.adobeconnect.com/intro-asha-plat-ssn1/event/event_info.html

22 May - 8 a.m. London; 12:30 p.m. New Delhi; 3 p.m. Singapore: http://forumnokia.adobeconnect.com/intro-asha-plat-ssn2/event/event_info.html

30 May - 8 a.m. San Francisco; 10 a.m. Mexico City; 4 p.m. London: http://forumnokia.adobeconnect.com/intro-asha-plat-ssn3/event/event_info.html
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to Nokia Asha software platform 1.0

INTRODUCTION TO NOKIA ASHA SOFTWARE PLATFORM 1.0

Michael Samarin Director, Developer Training and Evangelism Futurice @MichaelSamarin

Page 2: Introduction to Nokia Asha software platform 1.0

NOKIA ASHA SOFTWARE PLATFORM 1.0

• 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 • Very responsive UI, because of

the new underlying OS and new Oracle VM

• Series 40 Binary Compatibility

Page 3: Introduction to Nokia Asha software platform 1.0

WHAT’S NEW FOR 3RD PARTY DEVELOPERS Nokia Asha SDK 1.0

– Nokia Asha 501 Emulator, support for 47 languages – Nokia IDE 2.0 for Java ME – Offline Documentation – Tantalum Library – HERE Maps API – On-device debugger over WiFi

UI and graphics – LCDUI Changes – New LWUIT for Asha Release – Image scaling API – Gesture API: new double tap

App Framework – Internationalization API (JSR-238)

Networking – Network State API: SIM, network, WLAN change notifications

Page 4: Introduction to Nokia Asha software platform 1.0

WHAT’S NEW FOR 3RD PARTY DEVELOPERS Multimedia

– AMMS: Tuner, image encoding, image post processing – Video Recording – Removed com.nokia.mid.sound.Sound (Nokia UI)

Security – PKI support. – Removed APDU / SATSA-APDU

Data Handling – Contacts API: contact change notifications in phonebook (while MIDlet is active) – File Select API: use native file browser to select files – Phone Setting API: retrieve settings + change notifications: flight mode, data connection,

silent mode, etc. – Nokia Notifications API: subscribe + get payload of notifications

Page 5: Introduction to Nokia Asha software platform 1.0

HANDS-ON DEMO Nokia Asha SDK 1.0

– Nokia Asha 501 Emulator – Nokia IDE 2.0 for Java ME – Offline Documentation

Page 6: Introduction to Nokia Asha software platform 1.0

NEW ASHA UX

https://www.developer.nokia.com/Resources/Library/Asha_UI

Page 7: Introduction to Nokia Asha software platform 1.0

HARDWARE KEYS BACK BUTTON

Page 8: Introduction to Nokia Asha software platform 1.0

USER INTERFACE LAYOUT

Page 9: Introduction to Nokia Asha software platform 1.0

SCREEN SIZES AND AREAS

Page 10: Introduction to Nokia Asha software platform 1.0

CATEGORY BAR CHANGES - ACTIONS

Highlights current tab. Category bar should disappear when

drilling down.

Highlight only on touch down. Affect entire view, not a single

item within view.

Page 11: Introduction to Nokia Asha software platform 1.0

HANDS-ON DEMO Nokia Asha UI Components Demo

Page 12: Introduction to Nokia Asha software platform 1.0

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. • 25 Examples in SDK

Page 13: Introduction to Nokia Asha software platform 1.0

HANDS-ON DEMO LWUIT Components Demo

Page 14: Introduction to Nokia Asha software platform 1.0

TANTALUM LIBRARY

• Tantalum is a cross-platform Java library that provides a minimal set of functionality to easily create concurrent, networked applications: thread pool, HTTP networking with caching, logging and JSON support from org.json.me library. It’s a rather of a set of common best practices that has been validated to work on both Asha and Android, than a heavyweight compatibility wrapper.

• The approach is to strictly separate clean, concurrent, event-driven background application logic from clean, single thread event-driven user interface (UI) code. This way you can achieve the best-possible user experience (UX) on each platform you support by using the best native UI classes while re-using your application logic across all platforms.

Page 15: Introduction to Nokia Asha software platform 1.0

HANDS-ON DEMO Tantalum PicasaViewer Demo

Page 16: Introduction to Nokia Asha software platform 1.0

PHONE SETTINGS Current state & change listener subscriptions

– Flight mode – Data connection – Background data connection – Roaming data connection – Vibrator mode – Silent mode

Page 17: Introduction to Nokia Asha software platform 1.0

SETTINGS DETECTION

Page 18: Introduction to Nokia Asha software platform 1.0

NETWORK STATE

Monitor state of – Network (home / roaming) – SIM – WLAN

Page 19: Introduction to Nokia Asha software platform 1.0

NETWORK STATE DETECTION

Page 20: Introduction to Nokia Asha software platform 1.0

SIM STATE DETECTION

Page 21: Introduction to Nokia Asha software platform 1.0

WIFI STATE DETECTION

Page 22: Introduction to Nokia Asha software platform 1.0

FILE SELECT API • The File Select API allows MIDlets to use the device’s native file browser to list and select

files. The listing of files can be filtered by URL path and media type, and single as well as multiple files can be selected.

• The device’s native file browser provides its own UI and handles browsing, listing and selection of files. The File Select API pauses the thread, which is calling the API, till a file is selected or the operation is cancelled.

• MIDlets can use the File Select API to: – Select files to attach to a MMS or email message – Select files for uploading to a website (publishing, archiving etc.) – Select documents (PDF, DOC, TXT etc.) for viewing or editing – Select images for viewing or editing – Select audio or video clips for playback or editing

• Use the File Select API, if you want to list and select files, but do not want to implement the file listing and selection functionality by yourself.

• Note: The File Select API can launch only one instance of the device’s native file browser at a time.

Page 23: Introduction to Nokia Asha software platform 1.0

USING FILESELECT API • The File Select API consists of the following classes

(packaged as a part of the Nokia UI API):

• FileSelect – Use the FileSelect class to allow a MIDlet to list

and select files through the native file browser of the device.

• FileSelectDetail – Use the FileSelectDetail class to allow a MIDlet

to retrieve detailed information, like name, type, size and URL, about the selected files of the device.

Page 24: Introduction to Nokia Asha software platform 1.0

IMAGE SCALING API • The Image Scaling API allows MIDlets to downscale images by file size or by

dimension (i.e. width and height) with the aspect ratio of the image can be retained if required. For JPEG images, the output quality can be set before downscaling.

• Actual downscaling process is done outside of JVM, so no extra memory requirements for 3rd party apps.

• Note: The Image Scaling API cannot upscale an image, and does not allow users to select any protected images for downscaling due to security or copyright issues.

Page 25: Introduction to Nokia Asha software platform 1.0

USING IMAGE SCALING • The Image Scaling API consists of the following classes

and interfaces (packaged as a part of the Nokia API): • ImageScaler

– Use the ImageScaler class to allow a MIDlet to downscale images in the device.

• ImageScalerConstants – Use the ImageScaleConstants class to allow a

MIDlet to use the image scaler definitions generated by the configuration utility.

• ImageScalerListener – Use the ImageScalerListener interface to allow a

MIDlet to discover status of images being downscaled in the device.

Page 26: Introduction to Nokia Asha software platform 1.0

HANDS-ON DEMO New Nokia APIs

– FileSelect API – ImageScaling API

Page 27: Introduction to Nokia Asha software platform 1.0

WHAT ARE NOKIA NOTIFICATIONS FOR? • Real Push Notification service, similar to existing equivalents on Windows Phone,

Android and iOS. • Provides a way for 3rd party developers to deliver targeted notifications to individual

Asha devices with installed dedicated 3rd party Midlet. • Notifications are delivered in various forms to device:

– If Midlet is not running and device is locked: notification is delivered to the lock screen with associated audio / visual / vibration signal;

– If Midlet is not running and device is unlocked: notification is delivered to the upper notification area (similar to Windows Phone toast notifications) with associated audio / visual / vibration signal;

– If Midlet is running: notification is delivered directly to the Midlet. • In order to deliver notification, device must have enabled data connection.

Page 28: Introduction to Nokia Asha software platform 1.0

NOTIFICATION AT THE LOCK SCREEN

Page 29: Introduction to Nokia Asha software platform 1.0

NOTIFICATION AREA

Page 30: Introduction to Nokia Asha software platform 1.0

NOTIFICATION AT THE UPPER SLIDER

Page 31: Introduction to Nokia Asha software platform 1.0

NOTIFICATIONS APIS There are two parts:

– Nokia Notifications Service API (REST API); • Used by 3rd party service in order to contact Nokia Notification

Server and deliver targeted notifications to the individual devices. – Nokia Notifications Client API (Java ME);

• Used by 3rd party Midlet in order to register for the notifications delivery and actually receive notifications.

Page 32: Introduction to Nokia Asha software platform 1.0

REGISTERING NEW 3RD PARTY SERVICE • Developer must have valid free Nokia Developer ID; • Use web based Nokia Developer Consoler at:

https://account.nnapi.ovi.com/cm/Web/services.jsp • Create and generate with web tool:

– Service ID – Application ID – Service Secret

Page 33: Introduction to Nokia Asha software platform 1.0

NOKIA DEVELOPER CONSOLE UI

Page 34: Introduction to Nokia Asha software platform 1.0

IMPLEMENTING FULL SERVICE • Once service created, developer can use

Nokia Notifications Client API (Java ME) in Midlet and register for receiving notifications by using Service ID and Application ID.

• When Midlet is registered with service, it received unique Notification ID. This ID should be transferred to 3rd party service as unique identifier of Midlet and device.

• Using Nokia Notifications Service API (REST), 3rd party service contacts Nokia Notification Server and sends actual notifications with Service ID, Application ID, Service Secret, Notification ID.

Page 35: Introduction to Nokia Asha software platform 1.0

SANDBOX AND PRODUCTION

• Each service will have: – Sandbox environment; – Production environment; – Production environment in

China; • On device or emulator, developers

can switch environment with special Environment Selector from Nokia Asha SDK.

Page 36: Introduction to Nokia Asha software platform 1.0

NOKIA NOTIFICATIONS CLIENT API NotificationInfo

– Use the NotificationInfo to retrieve application specific settings from the Notification Enabler. NotificationMessage

– Use the NotificationMessage to receive notification messages from a service. NotificationPayload

– Use the NotificationPayload to receive notification payload from a service. NotificationSession

– Use the NotificationSession for communicating with the Notification Enabler. NotificationSessionListener

– Use the NotificationSessionListener to get notified when a message or a notification info is received, or when the notification status changes.

NotificationState – Use the NotificationState to determine the state of notification session i.e. whether the MIDlet is not connected,

connecting, or connected to receive notifications. NotificationEnvironment

– Use the NotificationEnvironment to specify the Notification Server environment for the Notification Enabler. NotificationError

– Use the NotificationError to determine errors related to the notification state and exceptions. NotificationSessionFactory

– Use the NotificationSessionFactory to create a notification session to communicate with the Notification Enabler.

Page 37: Introduction to Nokia Asha software platform 1.0

SEQUENCE OF STEPS FOR MIDLET Load the session by calling the NotificationSessionFactory and give the application identity:

private NotificationSession session; session = NotificationSessionFactory.openSession(midlet, "example.com", "com.example", this);

Request from session Notification ID and transfer to 3rd party service. Implement NotificationSessionListener;

Page 38: Introduction to Nokia Asha software platform 1.0

USING NOKIA NOTIFICATION SERVICE API (REST) WITH CURL

Test API: curl --digest -u "<SERVICE_ID>:<SERVICE_SECRET>" https://alpha.one.ovi.com/nnapi/1.0/ping

Send notification:

curl --digest -u "<SERVICE_ID>:<SERVICE_SECRET>" -d "toapp=<APPLICATION_ID>" -d "payload=Test" https://alpha.one.ovi.com/nnapi/1.0/nid/<NOTIFICATION_ID>

Page 39: Introduction to Nokia Asha software platform 1.0

NOTIFICATION PARAMETERS (1) payload

– Notification content. Payload can be max 1536 bytes long. System never touches this part (except for doing compression on the server side and decompression on the client side) - it is always provided to the recipient application "as is".

wakeup – Specifies whether an application that is not already running on the device should be

started when a notification is received. Note that a notification will only be displayed if the wake up parameter is set TRUE both in the Service API and the Client API. Default value is TRUE.

alert – Defines if an alert is to be triggered when notification is received. Valid values TRUE

or FALSE. Default value is FALSE. ctype

– Specifies the content type of payload as a mime-type (for example, application/xml, text/plain). Maximum length is 255 bytes.

enc – Defines the message content encoding (for example, Base64). Maximum length is 32

bytes.

Page 40: Introduction to Nokia Asha software platform 1.0

NOTIFICATION PARAMETERS (2) title

– Notification title. Maximum length is 140 bytes. subtitle

– Notification subtitle. Maximum length is 140 bytes. type

– Notification type. Maximum length is 20 bytes. icon

– Notification icon URI. This URI must point to the resource available publicly in web. Only PNG format icons are supported. Maximum length is 256 octets.

expires-at – If the recipient is not available, this parameter defines the time in seconds the

notification will be stored for the recipient. Maximum value is 1209600. toApp

– ID of the target application.

Page 41: Introduction to Nokia Asha software platform 1.0

HANDS-ON DEMO Nokia Notifications APIs

Page 42: Introduction to Nokia Asha software platform 1.0

THANK YOU!