Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

(Difference between revisions)

Cross-platform development for Nokia X & Asha

From Wiki
Jump to: navigation, search
shai.i (Talk | contribs)
(Shai.i -)
shai.i (Talk | contribs)
(Shai.i -)
Line 54: Line 54:
  
 
When you used the lwuit platform the entire build process was done locally on your PC, however in Codenameone in order to build the final binary (APK for Nokia X or Jar & Jad for Nokia Asha) you have to send the build to run on the codenameone cloud servers.<br />
 
When you used the lwuit platform the entire build process was done locally on your PC, however in Codenameone in order to build the final binary (APK for Nokia X or Jar & Jad for Nokia Asha) you have to send the build to run on the codenameone cloud servers.<br />
[[File:cn1_build_android_asha.png]||CN1 build menu for Android & Asha (j2me)]<br />
+
[[File:cn1_build_android_asha.png]]<br />
 
Once you send the build you can view its progress and its failed/succeed status in the [http://www.codenameone.com/build-server.html codenameone server page]
 
Once you send the build you can view its progress and its failed/succeed status in the [http://www.codenameone.com/build-server.html codenameone server page]
 
Before sending a build i suggest you test it thoroughly on codenameone emulator to avoid wasting time waiting for the server to finish building its queue.<br />
 
Before sending a build i suggest you test it thoroughly on codenameone emulator to avoid wasting time waiting for the server to finish building its queue.<br />

Revision as of 21:47, 14 April 2014


This article talks about cross-platform development for Nokia X & Asha from the point of view of current Asha lwuit developers.

Note.pngNote: This is an entry in the Nokia X Wiki Challenge 2014Q1

Article Metadata
Tested with
SDK: Nokia Asha sdk 1.1, Nokia X SDK
Devices(s): Nokia Asha 501, Nokia X
Compatibility
Platform(s):
Nokia Asha
Dependencies: Codenameone
Article
Created: shai.i (14 Apr 2014)
Last edited: shai.i (14 Apr 2014)

Contents

Introduction

If you previously developed apps for Nokia Asha/Series40 devices than you are probably familiar with LWUIT as it is one of the main platforms for building apps for Asha/Series40 devices with its rich UI & customizable wealth of components.
In this article i will introduce you to codenameone development platform which will help you to use your existing lwuit skills & know-how to cross-develop for Nokia X & Nokia Asha. Codenameone is open sourced and developed by the people who initially developed LWUIT who i know both in person and i must say they are both great developers.
As for me i often find myself using Codenameone for various apps or even games (even though the platform was never intended for games it is do-able) on my Nokia store publisher page http://store.ovi.com/publisher/Future%20soft/ you can find various apps developed with Codenameone that were build for Nokia Asha such as Snowman builder or even partly static games such as TicTacToe and my latest highly dynamic high fps game FlapFlap also note that all the mentioned above apps are also currently published to Nokia X so you can be sure its a viable option to develop and publish with it.

Note.pngNote: The links to Nokia X content currently cannot be viewed via desktop, the urls for the above 3 apps are: http://store.ovi.com/content/516558 http://store.ovi.com/content/516500 http://store.ovi.com/content/439105


Imports

The first thing you need to know when transitioning your apps from lwuit code to codenameone code is that the package names have been re-arranged and also changed so what was previously com.sun.lwuit.* is now com.codename1.ui.*
import com.sun.lwuit.Display; ===> import com.codename1.ui.Display;
import com.sun.lwuit.Form; ===> import com.codename1.ui.Form;

Resource file

If you wish to port an existing application from lwuit to codenameone and want to use your existing .res file then you should know that the lwuit .res file is of a much older file version specification and not supported in codenameone however you can try to import its content using the import feature in the codenameone resource editor (which is like the lwuit resource editor) by simply selecting your old .res file. Cn1 import feature.png

Note.pngNote: Another nice side benefit from transition to the new .res file format is that it can also be in XML which help you work on the file in team easily

Specific Asha components

Nokia specific version of LWUIT has some components and features that were unique to its Asha platform such as HeaderBar, TimePicker, ContextMenu, etc.
While you wont be able to use these specific components you could use either their codenameone replacements such as the InfiniteProgress, DateTimeSpinner, PopupDialog, etc. or try and build your own component.
Other than the Nokia custom components most of the other components exists in both platforms such as Labels, Buttons, Forms, Dialogs, Checkbox, etc.

The build process

When you used the lwuit platform the entire build process was done locally on your PC, however in Codenameone in order to build the final binary (APK for Nokia X or Jar & Jad for Nokia Asha) you have to send the build to run on the codenameone cloud servers.
Cn1 build android asha.png
Once you send the build you can view its progress and its failed/succeed status in the codenameone server page Before sending a build i suggest you test it thoroughly on codenameone emulator to avoid wasting time waiting for the server to finish building its queue.

Note.pngNote: Also each build you send to the server cost you 1 credit, however as a free user you have 100 credits per month which should be enough


Summary

While Codenameone can be used to develop for other platforms as well i mainly focused on Nokia X & Nokia Asha in this article because of the initial thought of LWUIT developers and utilizing their existing code-base.

371 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×