day1_1 what is new in new nokia asha
DESCRIPTION
http://winstore.vnTRANSCRIPT
![Page 1: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/1.jpg)
What is new in New Nokia AshaCao PhongDeveloper Tech Support ManagerAug 07, 2013
![Page 2: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/2.jpg)
New Nokia Asha 501SUPER SMART POCKET POWER
• Fastlane: everything you need on one screen
• Standout colour and design
• Battery: 48 days of battery stand-by
• Price: 1,989,000 VND
![Page 3: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/3.jpg)
Platforms
Developer Platform 2.0DP 1.1DP 1.06th Ed., FP16th Ed.6th Ed., Lite5th Ed., FP1 Nokia AshaSoftware
Platform 1.0Series 40
![Page 4: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/4.jpg)
2 Mb 2 Mb 2 MbAsha 305, 306 Asha 308, 309, 310 Asha 311
2 Mb 2 Mb 4 Mb-- -- 1 GHz
CapacitiveMultipoint-Touch
ResistiveMultipoint-Touch (2)
CapacitiveMultipoint-Touch (5)
Jar SizeJava Heap
CPU
Screen
5 Mb*Asha 501
3 Mb--
CapacitiveMultipoint-Touch (3)
![Page 5: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/5.jpg)
Development
Both free IDEs come with
extensive, generic Java ME support
on board.
![Page 6: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/6.jpg)
Installation• Java JDK + JRE 7
−Update 17 (Later versions do not work – emulator: internal RMI registry port issues)
−32 bit version (also on 64 bit OS)−http://www.oracle.com/technetwork/java/javase/downloads/index.html
• Nokia Asha SDK (includes Nokia IDE)−https://www.developer.nokia.com/Develop/Java/Tools/
• Optional: NetBeans 7 (All Edition!)−http://netbeans.org/
• Optional: Oracle Java ME SDK−http://www.oracle.com/technetwork/java/javame/javamobile/downloa
d/sdk/index.html
!
![Page 7: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/7.jpg)
NetBeans 7.3+
• NetBeans 7.x experience− Don’t choose Features on
Demand− Install Java SE + EE + ME
• Run NetBeans as Administrator once after Nokia SDK installation
− Integrates SDK docs
• Install additional plug-ins− Java ME SDK Tools− LWUIT Resource Editor− Java ME SDK Demos− Visual Mobile Designer
![Page 8: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/8.jpg)
What does my phone support?
www.developer.nokia.com/Devices/
![Page 9: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/9.jpg)
Versions
AshaSoftware Platform
Developer Platform
OS Version Phones
1.0 Asha Software Platform Asha 501
2.0.0 Series 40 Asha 305, 306, 308, 309, 310, 311
1.1.0 Series 40 Asha 200, 201, 302, 303
1.0.0 Series 40 Asha 202, 203; 301, C2-00, C2-02, C2-03, C2-05, C2-06, X2-02, X2-05
Series 40 6th Edition, FP 1 Asha 300, C3-01, X3-02
Series 40 6th Edition C2-01, C3-00, X2-00, X2-01, 6303i, 7230, 6350, 6750, 3720, ...
Series 40 6th Edition Lite C1-01, C1-02
Series 40 5th Edition, FP1 2690, 3208, 6600i, 2730, 2700, 6208, 6600, 8800, ...
Series 40 5th Edition, FP1 Lite 2220, 2720, 2320, 2330, 5000...
Series 40 5th Edition 3610, 6263, 6555, 7500, 6267
![Page 10: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/10.jpg)
CLDC
MIDP 248 MSA
185 JTWI
75 File
82 BT
135 Medi
a
172 Web RPC
172 Web XML
177 SATSAAPDU
177 SATSACRYP
T
179 Location
184 3D
205 Messagin
g
211 Content
226 SVG
234 Camera
234 Audio3D
234 Musi
c
234 ImageE/P
234 Tune
r
238I18N
256 Sens
or
Nokia UI
IAP
Asha1.0
1.1 2.1 - - 1.0 1.1 1.2 1.0 1.0 - 1.0 1.0.1 1.1 2.0 1.0.1 1.1 1.1 - - 1.1 1.1 1.6 1.2 1.7 beta
2.0.0 1.1 - 1.0 1.0 1.0 1.1 1.1 - - - 1.6 2.0
1.1.0 - - - - - 1.1 1.0
1.0.0 - - - - - 1.1b -
S40 6th,FP1
- - - - - 1.1b -
S40 6th
√ - √ - - - - 1.1 -
S406th Lite
- √ - - - - - - - - - -
S40 5th FP1
√ - 1.1 - √ - 1.0 1.0 - - - - -
S40 5th FP1
L
- √ - - - - - - - - - - - - - - -
S40 5th
√ - 1.1 1.0 1.0 - 1.1 - √ - 1.0 1.0 - - - - -
![Page 11: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/11.jpg)
SDKs
www.developer.nokia.com/Develop/Java/Tools/Series_40_platform_SDKs/
1 emulator per SDK.Install multiple SDKs for
more emulators.
www.developer.nokia.com/Develop/asha/java/downloads.xhtml
![Page 12: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/12.jpg)
Asha SDK 1.0 - Emulator
Simulate device UX
![Page 13: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/13.jpg)
Asha SDK 1.0 - Emulator
![Page 14: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/14.jpg)
Asha SDK 1.0 - Emulator
![Page 15: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/15.jpg)
Asha SDK 1.0 - Emulator
![Page 16: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/16.jpg)
Asha SDK 1.0 - Emulator• Offline Javadocs• Helpful Code examples
![Page 17: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/17.jpg)
Asha SDK 1.0 - Emulator
![Page 18: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/18.jpg)
Nokia IDE for Java ME
• Device SDK Selector
![Page 19: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/19.jpg)
Nokia IDE for Java ME
• Download Code Examples
![Page 20: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/20.jpg)
Demo- Asha SDK Emulator- Nokia IDE for Java ME
![Page 21: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/21.jpg)
New Asha UXde
velo
per.n
okia
.com
/Des
ign/
![Page 22: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/22.jpg)
Hardware Keys
![Page 23: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/23.jpg)
Back Button
![Page 24: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/24.jpg)
Demo- New Asha UX
![Page 25: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/25.jpg)
User Interface Layout
![Page 26: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/26.jpg)
Screen Sizes
Touch-and-type Full touch Nokia Asha
![Page 27: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/27.jpg)
UI Strategies
Custom UI on Canvas LCDUI High-Level UI LWUIT Library
![Page 28: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/28.jpg)
High Level UI
Display
CanvasScreen
TextBox FormList Alert
ChoiceGroup
DateField
TextField Gauge
ImageItem
StringItemChoice (Interface)
ItemSpacer CustomItem
Command
Ticker Graphics
Displayable
Low Level UIDraw the GUI yourself, own event handling. Used for
games and bigger commercial applications.
Completely pre-defined screen layouts
High Level UIAppearance based on default phone UI
design, can not be influenced.
Arrange predefined controls on a screen.
LWUITUI Library draws UI directly using low level
UI drawing methods.
![Page 29: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/29.jpg)
High Level UI
Display
CanvasScreen
TextBox FormList Alert
ChoiceGroup
DateField
TextField Gauge
ImageItem
StringItemChoice (Interface)
One Display instance / MIDlet
Methods for drawing to a
canvas
Available in all sub-classes of
Displayable
ItemSpacer CustomItem
Command
Ticker Graphics
Displayable LWUIT
![Page 30: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/30.jpg)
High Level UI: Forms
Individual items, automatically arranged below each other. The
appearance depends on the phone.
WTK Emulator Nokia 7710 Emulator
![Page 31: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/31.jpg)
LWUIT
• LightWeight User Interface Toolkit− Inspired by Swing, but designed for constrained
devices− Can be added to any Java ME application
(embedded .jar)− Drawing done in Java source code, without native
peer rendering• Optimized version for Nokia!• Features (excerpt):
− Layouts− Themes, fonts− Animations & Transitions− 3D / SVG integration (optional)− Internationalization
![Page 32: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/32.jpg)
Remote Device Access
• Enabling testing on real devices
• Free for Nokia Developer users
• Go to RDA: http://www.developer.nokia.com/Devices/Remote_device_access/
• Watch introductory video: http://www.developer.nokia.com/Develop/Java/Videos/
• http://www.youtube.com/watch?v=F1odix8k_fg
![Page 33: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/33.jpg)
Internationalization
• JSR-238−Format data for locales−Locale-aware string comparison−Translation: manage app & device resources
![Page 34: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/34.jpg)
Formatter
• Locale-specific data−dates, times, numbers,
percentages, currency• Generic message formatting
−placeholders {n} / {nn}
Asha EmulatorSupported locales
enkn-IN
taur
// Text definitionsString txtCurrency = "Currency: {0}"; // [...]String txtTime = "Time: {0}";
// No parameter -> would use current locale (microedition.locale)Formatter format = new Formatter("kn-IN");frmMain.append(Formatter.formatMessage(txtCurrency, new String[] {format.formatCurrency(currency)}));frmMain.append(Formatter.formatMessage(txtTime, new String[] {format.formatDateTime(dateTime, Formatter.TIME_LONG)}));
Example: InternationalDemo
![Page 35: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/35.jpg)
Phone Settings
• Current state & change listener subscriptions−Flight mode−Data connection−Background data connection−Roaming data connection−Vibrator mode−Silent mode
![Page 36: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/36.jpg)
Setting Detection• Retrieve setting
int settingState = Setting.getSetting(Setting.SETTING_FLIGHT_MODE);
ONOFFINVALIDDENYASKACCEPTWIFIONLY
SETTING_FLIGHT_MODESETTING_DATA_CONNECTIONSETTING_BACKGROUND_DATA_CONNECTIONSETTING_ROAMING_DATA_CONNECTIONSETTING_VIBRATORSETTING_SILENT
Example: PhoneSettings
State changes available via listener
![Page 37: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/37.jpg)
Network State• Monitor state of
−Network (home / roaming)−SIM−WLAN
![Page 38: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/38.jpg)
Network State Detection
• Retrieve status for SIM cardExample: PhoneSettings
int networkState = NetworkState.getState(simCard);
NETWORK_STATE_NO_NETWORKNETWORK_STATE_HOMENETWORK_STATE_ROAMING
01
State changes available via listener
![Page 39: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/39.jpg)
SIM State Detection
• Retrieve status for SIM cardExample: PhoneSettings
int simState = SIMState.getState(simCard);
SIM_STATE_READYSIM_STATE_NOT_READYSIM_STATE_NO_SIM
01
State changes available via listener
![Page 40: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/40.jpg)
Network State Detection
• Retrieve status for WLANExample: PhoneSettings
int wlanState = WLANState.getState();
WLAN_STATE_CONNECTEDWLAN_STATE_NOT_CONNECTED
State changes available via listener
![Page 41: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/41.jpg)
Demo- PhoneSettings
![Page 42: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/42.jpg)
File Selection• Native file browser UI to list + select
files− Images & documents for viewing /
editing−Files for uploading to web service & as
message attachments−Audio or video clips for playback
• Blocks calling thread−Don’t use in event handling thread
(e.g., command action)
SDK Example: FileSelectExample
![Page 43: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/43.jpg)
Launch File Dialog• Launch file selection (in own thread)
Example: SimpleFileSelect
// Launch file selection dialogFileSelectDetail[] arrSelectedFiles = FileSelect.launch(
FileSelect.FILE_SYSTEM_ALL, FileSelect.MEDIA_TYPE_ALL, false);
FILE_SYSTEM_ALL FILE_SYSTEM_EXTERNALFILE_SYSTEM_INTERNAL… or specific start folder, e.g.,System.getProperty("fileconn.dir.photos")
MEDIA_TYPE_ALLMEDIA_TYPE_APPLICATIONMEDIA_TYPE_AUDIOMEDIA_TYPE_PICTUREMEDIA_TYPE_VIDEO
false: single-filetrue: multi-file
![Page 44: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/44.jpg)
File Selection Results• Print metadata of selected file(s)
if (arrSelectedFiles != null) {// Show file meta data on the screenfor (int i = 0; i < arrSelectedFiles.length; i++) {
// Display name = file namefrmMain.append("Display name: " + arrSelectedFiles[i].displayName);// MIME type, e.g., video/mp4 or image/pngfrmMain.append("MIME type: " + arrSelectedFiles[i].mimeType);// Size of the selected file in bytesfrmMain.append("Size: " + arrSelectedFiles[i].size);// Full path to the filefrmMain.append("URL: " + arrSelectedFiles[i].url);
}}
Example: SimpleFileSelect
![Page 45: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/45.jpg)
Demo- FileSelect
![Page 46: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/46.jpg)
Notification API
• Push messages to user’s phones
−Also when app is not running
−Notification banner−Caches up to 5 messages
per app (for up to 14 days)−Payload ≤ 1.5 kB
SDK Example: NNAClientExample
![Page 47: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/47.jpg)
Notifications – Sign Up• Register new service ID
−Creates service secret−https://account.nnapi.ovi.com
/cm/Web/services.jsp
• Environments−Sandbox for testing−Production available after 5
days−Separate server for China
![Page 48: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/48.jpg)
Notifications Flow – Client
Do you want to receive service X
related push notifications?
App needs to ask user for consent
App registers with online push
service
App retrieves client-specific notification ID, sends to own
notifications web service
1 2
Your own custom web service, manages
notification IDs from subscribed clients
![Page 49: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/49.jpg)
Notifications Flow – Push
User gets push notification
Notification bar shows details
4
3 Sandbox testing in Developer Console: push messages without need for own web service
![Page 50: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/50.jpg)
Notifications Flow – Retrieve
User launches app (e.g., through notification bar).
App registers online.
App gets cached push
notifications.
Note: user can turn off
notifications for apps.
![Page 51: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/51.jpg)
EnvironmentSelector
• App for device / emulator−Swich between push servers
C:\Nokia\Examples\Nokia_Asha_SDK_1_0\NNAClientExample\EnvironmentSelector
![Page 52: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/52.jpg)
Client Implementation• Open session
−1 session / app−Keep open for lifetime of app
• Register app
−Callback: stateChanged(NotificationState.STATE_ONLINE)
NotificationSession session = NotificationSessionFactory.openSession(main, // The MIDlet instance"example.com", // Service ID (Deprecated, but still has to be provided)"com.example", // Application IDthis); // NotificationSessionListener
session.registerApplication();
Developer Console
![Page 53: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/53.jpg)
Client Implementation• Get Notification ID for this phone
−Callback: infoReceived(NotificationInfo info)−Send this to your web service
• Receive messages
session.getNotificationInformation();
public void messageReceived(NotificationMessage message) {// Get data as stringString msgData = message.getPayload().getData();
}
![Page 54: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/54.jpg)
Notification Service
• Push via REST API (HTTPS)−From own web service−To Nokia Notification Server
www.developer.nokia.com/Resources/Library/Java/#!developers-guides/nokia-notifications/nokia-notifications-service-api-rest-api.html
![Page 55: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/55.jpg)
Push Messages• Messages
−App running?−No info banner, directly delivered
−Not running?−≤ 5 messages cached−Customizable: info banner, alert
• Delivery confirmations−Not part of Nokia service−Own app can contact own web service
![Page 56: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/56.jpg)
Message Properties
Checked: delivered also when app is NOT running
Checked: user is alerted about new message
Notification title shown to the user
Not used / shown / accessible
MIME type of payload. Default: application/octet-stream
Not used. App icon shown instead
Maximum cache lifetime (≤ 14 days)
Raw payload to send to the app
Notification ID of the client to push to
![Page 57: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/57.jpg)
Demo- NNAClientExample
![Page 58: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/58.jpg)
Tuner• AM / FM radio
−Tuning−Seeking−Squelch−Stereo mode−Signal strength query−Presets
• Advanced Multimedia Supplements (JSR-234)
SDK Example: AMMSTuner
![Page 59: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/59.jpg)
Seek Radio Channels• Initialize radio
• Start playing
Example: Radio// Create generic Java ME player, with the specific radio URLplayer = Manager.createPlayer("capture://radio");// Construct playerplayer.realize();// Get controller to control radio (seeking, specifying properties, etc.)tuner = (TunerControl) player.getControl("javax.microedition.amms.control.tuner.TunerControl");
// Minimum frequency in FM band to start searchcurFrequency = tuner.getMinFreq(TunerControl.MODULATION_FM);// Start playingplayer.start(); // Start search for the first stationcurFrequency = tuner.seek(curFrequency, TunerControl.MODULATION_FM, true);
![Page 60: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/60.jpg)
Demo- AMMSTuner (Device)
![Page 61: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/61.jpg)
Touch Gestures• Use in: Canvas-/CustomItem-based classes
−Optional: combine with Frame Animator API (kinetic scrolling)
• Available since Touch & Type−Tap: touch + release−Double Tap: touch + release + touch + release (new in Asha
Platform)−Long Press (& repeated): touch + hold−Drag: touch + drag−Drop: touch + drag + touch down (“stop”) + release−Flick: touch + drag + release while dragging−Pinch: 2x touch + 2x drag + 2x touch down (“stop”) + 2x
release (new in Full Touch)
![Page 62: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/62.jpg)
Gesture Components
App
Java Runtime
GestureAction
RegistersRegisters
GestureListener
GestureInteractive
Zone
GestureRegistration
Manager
![Page 63: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/63.jpg)
Using: Gestures• Register as gesture listener
−Zone: reacts to 1+ specified gestures−Whole screen or rectangular area−Overlap possible
−Received events → GestureListener
public class MainCanvas extends Canvas implements GestureListener {private int curPinchDistance = -1;public MainCanvas() {
// Set this as container (gesture source) and listenerGestureRegistrationManager.setListener(this, this);// Register for pinch events in the whole canvas areagestureZone = new GestureInteractiveZone(GestureInteractiveZone.GESTURE_PINCH);GestureRegistrationManager.register(this, gestureZone);
}
Example: PaintApp
![Page 64: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/64.jpg)
Using: Gestures• Handling gestures
−Executed in UI thread−Lengthy operations (scaling image, etc.) → own thread!
−Parameters only valid during call (instances reused for next call-back)
public void gestureAction(Object container, GestureInteractiveZone gestureInteractiveZone, GestureEvent gestureEvent) {int eventType = gestureEvent.getType();switch (eventType) {
case GestureInteractiveZone.GESTURE_PINCH: // Pinch detectedcurPinchDistance = gestureEvent.getPinchDistanceCurrent(); break;
case GestureInteractiveZone.GESTURE_RECOGNITION_START: /* ... */ break;case GestureInteractiveZone.GESTURE_RECOGNITION_END: /* ... */ break;
}}
![Page 65: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/65.jpg)
Demo- Gesture
![Page 66: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/66.jpg)
Image Scaler APIPros:• Simple usage• Fast performance• Resolve heap size
bottleneck
Cons:• Upscaling is not
completely supported due to uncontrollable memory use
![Page 67: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/67.jpg)
Image Scaler API1. import com.nokia.mid.imagescale.*
2. Construct a new ImageScaler object with source and destination path of the image:
3. Apply for JPEG files: use the ImageScaler.setJpegQuality method for specifiying output quality of the JPEG image:
4. Use the ImageScaler.scaleImage method for downscaling image in two ways:
//Construct a new ImageScaler object to downscale a JPEG image on the deviceImageScaler is = new ImageScaler("file:///Phone/big.jpg", "file:///Phone/small.jpg"); // PNG file is OK
//Set image quality for the JPEG imageis.setJpegQuality(70);
//Set the downscaled image’s file size to be less than or equal to 100kbis.scaleImage(100);
//Set the downscaled image’s dimensions to 320x480px, and ignore the source image’s aspect ratiois.scaleImage(320, 480, false);
![Page 68: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/68.jpg)
Image Processing – AMMS (JSR-234)• Convert image format:
png, jpg…• Image transformation:
Crop Zoom Mirror Flip Stretch Rotate
• Image filters: Monochrome Negative Emboss Sepia Solarize Redeyereduction
o interface javax.microedition.amms.control.imageeffect.ImageEffectControlo interface javax.microedition.amms.control.imageeffect.ImageTonalityControlo interface javax.microedition.amms.control.imageeffect.ImageTransformControlo interface javax.microedition.amms.control.imageeffect.OverlayControlo interface javax.microedition.amms.control.imageeffect.WhiteBalanceControl
![Page 69: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/69.jpg)
Image Processing – AMMS (JSR-234)
MediaProcessor mp = GlobalManager.createMediaProcessor("image/jpeg"); InputStream inputStream = ... // create a InputStream that contains the source image OutputStreamoutputStream = ... // create a OutputStream that will receive the resulting image
mp.setInput(inputStream); mp.setOutput(outputStream);
// Define effects to be applied during processing ImageEffectControl imageEffect = (ImageEffectControl)mp.getControl("javax.microedition.amms.control.imageeffect.ImageEffectControl"); imageEffect.setPreset("monochrome");
// Set output format ImageFormatControl fc = (ImageFormatControl)mp.getControl("javax.microedition.amms.control.ImageFormatControl");fc.setFormat("image/jpeg"); fc.setParameter("quality", 80);
// Do the actual processing. If you do not want to use a blocking call, // use start() and MediaProcessorListener. mp.complete();
Apply monochrome effect
![Page 70: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/70.jpg)
Demo- ImageScaler- Imaging
![Page 71: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/71.jpg)
Contact APIDiscover and receive changes to the device’s contacts in the phonebook. MIDlets can use the Contact API to discover when:
• Contacts are added to the phonebook
• Contacts are deleted from the phonebook
• Contacts are modified, i.e. the fields of the contacts are changed, in the phonebook
![Page 72: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/72.jpg)
Sensors
• JSR 256 - Sensor API− Generic: designed also for
temperature, blood pressure, etc.
• Currently supported− Battery Charge: 0 .. 100, charge
percentage− Network Field Intensity: 0 .. 100,
signal strength− Charger State: 0 .. 1, charger
connected− Acceleration: –2g .. +2g, x / y / z
axis− Double Tap: 1 .. 63, phone sides− Orientation: 0 .. 6, phone
orientation
![Page 73: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/73.jpg)
![Page 74: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/74.jpg)
![Page 75: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/75.jpg)
Double Tap Sensor
http://www.developer.nokia.com/Resources/Library/Java/_zip/GUID-F031C633-5F4E-441E-A863-CE4E28A9CD55/appendixE.html
![Page 76: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/76.jpg)
Finding Sensors
Application SensorManager SensorInfo Connector
findSensors(quantity, contextType)
return SensorInfo[]
getUrl()
return URL
Connector.open(URL)
return SensorConnection
![Page 77: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/77.jpg)
Sensor Values
• Modes− Synchronous
− Poll sensor− Example: accelerometer in game loop
− Asynchronous− DataListener callbacks− Example: phone charger plugged in
![Page 78: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/78.jpg)
Using: Sensors• Establish sensor connection
• Check data in game loop
// Find all acceleration sensors, the contextType is left undefinedSensorInfo[] sensorInfos = SensorManager.findSensors("acceleration", null);// Find an acceleration sensor that returns double valuesfor (int i = 0; i < sensorInfos.length; i++) {
if (sensorInfos[i].getChannelInfos()[0].getDataType() == ChannelInfo.TYPE_DOUBLE) {accSensor = (SensorConnection) Connector.open(sensorInfos[i].getUrl());
}}
// Use 1 as a buffer size to get exactly 1 value for each axisData[] data = accSensor.getData(1);speedX = -data[0].getDoubleValues()[0]; // data[0] => x-axisspeedY = data[1].getDoubleValues()[0]; // data[1] => y-axis
Example: MovingBall
![Page 79: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/79.jpg)
![Page 80: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/80.jpg)
Demo- Racer- Double Tap Soccer (Device)
![Page 81: Day1_1 what is new in new nokia asha](https://reader036.vdocuments.us/reader036/viewer/2022081717/54b2d28e4a7959aa518b4570/html5/thumbnails/81.jpg)
THANK YOU!Nokia Vietnam – Developers Experience: https://www.facebook.com/groups/viet.nok.dev/