Showing posts with label nokia. Show all posts
Showing posts with label nokia. Show all posts

Feb 12, 2014

StocksMe: Development Notes

Hi, all

It is a great pleasure that I am here again to launch my newest app for the Nokia Asha platform, called StocksMe, and share with you some technical details involving its development.

In short, StocksMe is an app for people that follows the stocks market. Through a simple and straightforward user interface, this app allows the user to create their own list of indexes (e.g. NASDAQ) and/or companies (e.g. Nokia) to follow. The quotes have information like price, change, open, high/low, chart, etc. It's basically what every investor needs to make a decision to buy/sell stock shares.

StocksMe is available for download from the Nokia Store, for a price of $1.99.

This app was meant to be supported by ads, but in the last minute I changed my mind and decided to make it paid. It is all this article's fault. :)

Well... Now to the point that is the focus of this blog: development.

StocksMe was developed for the Nokia Asha 1.1 platform, but since it does not use anything specific to this release, the app also works perfectly in version 1.0.

The development environment was the Nokia Asha SDK 1.1, Nokia IDE for Java ME (based on Eclipse) and Nokia Asha 502 Emulator. The three pieces work very well and fully integrated. Just create the project, set the platform, code and run on the emulator/device. When you run the MIDlet, the IDE automatically starts the emulator to run the app.

During development, I did not try the function that lets you send the application to the device directly from the IDE. Only did in the old way, copying to the device and then manually running. I will try the first option next time.

The Nokia Asha 502 Emulator works very well and faithfully reproduces the environment found in the real device. However, as I do not have a Nokia Asha 502, I ended up performing the tests on my Nokia Asha 501.

Speaking of app's architecture, StocksMe’s is practically the same as CurrencyMe’s, which we talked about a while ago. It is based on the traditional MVC. For those who want to take a better look at this architecture, I suggest you to download CurrencyMe’s source code.

For the user interface, again opted by LWUIT for S40, which brings some new components (e.g. Switch, HeaderBar, FormItem, SearchBar), besides the looking and feel of the platform. Each version Nokia has brought good news for the LWUIT. I have greatly enjoyed working with this porting.

Specifically in this app, I used for the first time SearchBar component. This implements a kind of search bar, where you define a list of items that can be searched. As the user types, a list of the results is presented. Very useful for implementing a field with suggestions of values​​.


For the StocksMe, it was used for performing the search for indexes/companies from some string. But in this scenario, I have not used a fixed list for the results. As the user types the filter, I access a service that returns me the indexes/companies that match the criteria informed. Cool and flexible this component. Liked it!

Another component used that is worth the registry is the PullDownRefresh. This implements the gesture "Pull Down to Refresh". It was used in actions to update the data. My idea was to use gestures as much as possible, then this one could not miss.


PullDownRefresh v1.1 was developed during the development of StocksMe. To learn more, read this post.

It is also worth mentioning that Nokia has developed a similar PullDownRefresh component, RefreshLoadBar. I confess that I tried to use it, but the fact that it does not allow (at least I did not find how) me to translate the texts into other languages ​​made ​​me give it up.

Above, I mentioned that the LWUIT for S40 brings the Nokia Asha platform’s looking and feel. However, this does not mean we can not change some things. I made some adjustments to colors, fonts, margins, etc. In case I did it programmatically, through UIManager class, because I did not want to change the theme file that comes within the lib file.

Change the theme file can be a bad idea, if you decide to migrate to a new lib’s version. This can come with fixes and/or styles for new components, which will complicate your life, since you will have to do a merge or copy all of your changes to the new theme file.

To conclude the subject on user interface, I will try to discourse briefly about a technique I learned to make list scrolling faster. In turn, this technique is better off for lists whose items demand a more complex arrangement of the graphical components, which needs the use of containers, style changes and layout managers, for example.

This technique dispenses the use of the List and ListCellRenderer components. As you know, the List component uses a ListCellRenderer to paint its items on the screen. During the scrolling, List repeats this painting operation several times for each of its items. To paint, ListCellRenderer runs through your component hierarchy to obtain the final painting. This operation is slow for items with a large number of components. This is the case of StocksMe’s list of quotes, where each list item has four Labels and two Containers, besides using the BorderLayout layout manager.


The list scrolling was too slow, so I searched for tips to improve the performance. In LWUIT’s documentation, which comes with the Nokia Asha SDK, there are some topics on optimization, but one caught my attention: Image Buffering.

Image Buffering was demonstrated in RLinks app, which is one of the sample apps that comes with the SDK. It uses a Container instead of a List component. Items are also Containers that extend a class called ListItem (developed by the app). ListItem caches the outcome of its first paint operation in an image. So, in all successive paintings, this cached image is painted instead. If there is any change in the component’s state, this cached image is then discarded and a new one is generated. This technique avoids the components’ hierarchy be ran through for all painting operations, thus providing a significant performance gain.

The result in the list of quotes was excellent! Now it scrolls pretty smooth, thus increasing the user experience.

There are more points in this Image Buffering technique that deserve a more detailed explanation, but this is not the focus of this post. For those interested, I suggest taking a look at RLinks’s source code. I'm sure it will be useful for many developers.

Speaking of data access service, once again I opted to use Networking ME project. As explained in this post, this facilitates access to data via HTTP.

The stock quotes service used by the app, Yahoo! Finance, returns data in three formats: CSV, quotes; JSON, search indexes/companies; and image, chart. For this, I used the new handlers CSVListener, JSONListener and ImageListener (LWUIT), introduced in version 1.1. These new listeners facilitated my life, because I did not have to worry about any content parsing.

For those who want to know more about Networking ME, I suggest to stop by on the project page.

To conclude this post, I would like share a point about the app’s publishing. I always use in-app analytics, for better understanding on how users use it, in order to improve it. I do this through Google Analytics, using Google Analytics ME project. However, I had a surprise this time.

Seven days since I published the app, Nokia finally evaluates it. Result, the app was rejected! The reason was because I did not provide an opt-out for in-app analytics. This has changed recently and I was not aware about this. Anyway, I added the opt-out and three days after that the app was finally approved.

Stay tuned those who are publishing a new app or an update that this is now mandatory.

Well folks, those were the main technical details I would like to share with you. It was really cool to develop this app and I hope it is useful for its users. I already have several ideas to make it even better. Hopefully the number of downloads encourage me to work on them. :)

See you in the next post...

Sep 27, 2013

CurrencyMe: The Power of Nokia Asha Platform

Hi, all

Today I would like to announce my new app CurrencyMe: the perfect tool to follow over 30 currencies rates in real-time.

Based on your local currency, the app displays the conversion rate to other currencies. Pretty useful tool for investors or travellers.

CurrencyMe was developed in order to show off the power of new Nokia Asha Platform, currently represented by the device Nokia Asha 501.

Asha Platform is built on top of CLDC 1.1 and MIDP 2.1.

Regarding user interface, there is a tailored version of LWUIT, which brings interesting new components. LCDUI can also be used.

CurrencyMe is a very simple app, however, it was possible to implement a good set of features, in order to use as many new components as possible brought by Asha platform.

See below the list of all components X features:

PopupChoiceGroup: A new LWUIT component that allows to pick a value from a popup list. It is used for the user to pick the default currency.

FormItem: A new LWUIT component that consists of one or two rows, can optionally receive a main icon displayed on the left and a smaller action icon displayed on the right, and it can be used to trigger up to two actions. It is used in the About screen to display the details of the app, i.e., name, version and vendor.

HeaderBar: A new LWUIT component that allows the user to create a custom HeaderBar which can be added on Form, to create informative and interactive header bars, and has action buttons. It is used to display the screens' title. This component provides a spinner, which makes easy to show that some background operation is in progress, e.g., loading data from the Internet.

GroupHeader: A new LWUIT component that allows to create a header which can be added on Form, and is used to separate a group of items. It is used to group the settings in the Settings screen.

Switch: A new LWUIT component used to quickly switch between two opposite values. It is used to switch on/off automatic data refresh during start-up.

LocaleManager: A class from Internationalization API (JSR-238) that allows apps to retrieve locale information stored on the device  It is used identify device's locale to figure out the local currency.

Formatter: A class from Internationalization API (JSR-238) that allows apps to make use of internationalization services provided by the API. It is used to format the date/time and value of the rates, according to device's regional settings.

Network State Changes: A set of classes that allows to identify the network state, e.g. if there is a SIM card inserted or wi-fi is connect. It used to prevent the user to refresh data in case there is no Internet connectivity.

Besides all these new components, other libraries were used as well:

CurrencyMe is integrated to Nokia Ad Exchange, a private mobile advertising exchange offering access to the top ad networks in the world. It was very is get the app integrated.

Networking ME, a networking library for Java ME platform, was used to implement the access to currency rates service.

To collect data about app's usage and send data to Google Analytics, Google Analytics ME was used for this task.

Besides showing the tools that were used to build this app, it is also important to show the code for it. For that, I decided to provide the app's source code so you guys can take a look. This code is under GPL. There are some good reusable components to work with Record Store, NAX, GA, etc. For these ones, MIT license is applied.

To download the source code, click here!

Hopefully you guys enjoy the app and the source code.

See you in the next post...

Feb 25, 2013

Multiple HTTP Headers for S40: Fixed!

Hi, all

Long time since last time, hah? Sorry! Quite busy!

Back in 2011 we reported a problem on Nokia S40 platform. That time I would like to be able to access multiple HTTP headers of the same type, i.e. Set-Cookie. Unfortunately, I found it was not possible, because of a bug in the platform. It was a shame, since I had to implement a workaround for a feature that I was working on in one of my projects due to this issue.

But now, furtunately, I am here to share that this issue was fixed by Nokia in S40 SDK 2.0, present in the new multi-touch Asha devices.

Skalogir - Update 16th of August 2012

This issue is still present and affects both Symbian and Series 40 devices. After extensive hands on testing, I have updated the categories. The error is fixed on S60 5th Edition and Series 40 Developer Platform 2.0. Any previous platforms are affected by this.

Great, isn't it? I tried it out and it really works. Finally, I was able to implement my feature the way I wanted.

On the other hand, it is fixed only for SDK 2.0. So, if your app still targets older versions of S40, you will have to handle it.

One more time, thanks Nokia.

See you in the next post...

Jun 28, 2012

LWUIT for Series S40

Hi, all

Nokia has done a great job on its Series S40! Of course, they are low cost devices, but they are quite functional and bring good specifications (touch, GPS, Wi-fi, etc). In addition, the design of some of them is very pleasant and thin, for instance, the Asha family. I tried Asha 303, X3-02 and C3-00, and I liked the result!

Other good news is that Series S40 has a powerful Java ME environment. A bunch of JSRs are supported (most of them present in the whole series), specific Nokia API, e.g. Maps API (you gotta check out this one!) and In-App Purchasing, and Nokia IDE (Eclipse-based) and many other tools. Nokia is now releasing its SDK 2.0 for Series S40, along with new devices: Asha 305, 306 and 311. All of them now full touch. 

Now let's stick to the post's title.


Taking the opportunity of the launch of its new SDK, Nokia is also releasing LWUIT for Series 40, a work done with LWUIT team, which built an optimised version of LWUIT for S40 with a number of styling, theming, and functional changes. This version has a total integration with some features presente on S40 devices, e.g. native keyboard and S40 gesture framework. LWUIT for S40 can be used to create applications targeted at Series 40 5th Edition and newer devices.

This optmization has provided some notable changes on LWUIT components (e.g. Form, List, TextArea, TextField, etc) so they can take advantage of platform's features and look more integrated to S40's UX. On the other hand, these changes are transparent to developers. So if you are already familiar with LWUIT's APIs, don't worry!

You can find all those changes and other useful information, e.g. installation and other resources, about LWUIT for S40 in this Wiki page.

The link to donwload is here.

Nokia, thanks for boosting Java ME for real.

See you in the next post...

Dec 6, 2011

Multiple HTTP Headers: No cookie for you

Hi, all

As you may know, HTTP Cookies are mostly used to track sessions between a client and a server. The flow is pretty simple: you access a server and it returns a piece of information (a cookie), which the client stores, in order to send back in every subsequent request. Based on this cookie, the server identifies the client.

Unfortunately, this session management must be handled by the developer, since HttpConnection does not do that automatically. This is achieved in a very simple way and a few lines of code. If do not know how to do it, please learn now here.

According to the example at Nokia's page, session management using a single cookie is very easy. How about two? It should be easy as well. Instead of only one, now you have to store two and send them back.

In a project that I am currently working on, there are two cookies to manage the session. As I said above, it is very easy, right? It should be. I am porting a code from Nokia S60 5th Edition series to S40 6th Edition. This session management works like a charm, but it fails on S40. Any guess? No? Read the post's title again. The answer is:

Series 40 platform devices up to Series 40 6th Edition and Series 40 5th Edition, Feature Pack 1 Lite, and S60 devices prior to S60 3rd Edition, Feature Pack 1 does not support multiple HTTP header. It means that two cookie cannot be handled, because only one is available. Nice, hah?

Long story short, we had to implement a workaround in our server for S40 version, where only one cookie is used for session management. As a consequence of it, this version accesses a no scalable server, since the second cookie was used for load balancer.

W.O.R.A does not work so well on mobile devices.

See you in the next post...

Feb 11, 2011

Soundtrckr: Internet Radio with Java ME

Hi all,

I would like to introduce an interesting app developed with Java ME and eSWT, which is part of the series where Nokia is inviting the coolest app developers to showcase and pilot their apps at Nokia Beta Labs. This app is called Soundtrckr.

Soundtrckr is the first Geosocial Internet radio. It has the largest fully licensed music catalog for Internet radio in the world, plus tons of social and location-based features to help you discover and share music that you can’t find anywhere else. See below some features available on Soundtrckr:
  • Listen to more than 10 million fully licensed songs
  • Create and share personal radio stations
  • Play music with friends in real time
  • Search your city for popular music and people with similar taste
  • Share your favorite stations on social networks
Since it is still in lab, Soundtrckr team is inviting developers to test its beta version in order to receive some feedbacks and then improve the app as much as they can. So, if you are interested in being part of this testing process, click here and find out. On the other hand, if you are just interested in enjoying all features by Soundtrckr, you can download it directly from Ovi Store.

Soundtrckr is available for Nokia N8 and other Symbian S^3 devices as well as S60 5th edition devices. Regarding S60, the version on beta labs requires JRT 2.1 and the Ovi's one, 1.4.

For further information Soundtrckr, access the app's page at Nokia Beta Labs.

Before I forget, Soundtrckr works with Twitter API ME in order to implement the functionalities related to Twitter. Cool, huh?

See you in the next post...

Jul 4, 2009

Ovi Store and Java Verified: False Alarm

Hi all,

I will not write much on this topic here, but I would just like to have it registered, because there are already many discussions on the Internet, about this misunderstood that Ovi Store is requiring Java Verified certificate for all its candidate applications.

To sum up all the discussions, Ovi Store does NOT require that applications go through Java Verified process before being submitted. However, it just requires that every application be signed by Verisign or Thawte, for instance.

Java Verified is a very expensive testing process (~$175 per device), which is totally impracticable for independent developers, which, most of times, just upload their free applications in order to become popular on Internet, show their skills or merely get a better job. However, for those developers still interested in Ovi Store, be prepared to expend ~$500 to sign their applications. That's the average price charged by Verisign, for instance, to sing an application for one year period.

I believe that Nokia made the right decision!

To have more details on this discussion, see the links below:
http://discussion.forum.nokia.com/forum/showthread.php?t=169019
http://blogs.s60.com/2009/05/ovi-store-not-requiring-java-verified

See you in the next post...

May 20, 2009

JSR-256 on Nokia 5800 devices

Hi all,

Nokia is releasing a beta installation package for Mobile Sensor API (JSR-256), which target is the Nokia 5800 devices (e.g. Nokia 5800 XpressMusic), which firmware version is 21.0.025 or later.

It is good apportunity to take a look into this great API, besides getting rid of those workrounds that developers have been implemented to have this feature on theirs Java ME apps. For instance, a workround that is very commom is to create a small Python script that connects to the device's accelerometer and then starts a server socket, which the apps can get connected to, in order to read the data from the accelerometer.

That's what I call: An exercise of creativity. :)

So, if you have a Nokia 5800 series device, try it out at here.

See you in the next post...

p.s: There is only one Nokia's device that already supports JSR-256: N97.

Oct 20, 2008

Nokia is Calling All Innovators

Hi all,

Calling All Innovators. This is the name that Nokia is calling its applications contest, which is very similar to Sony Ericsson's one published in our last post. It seems that the contests season is open. :)

They are seeking very innovative applications, developed in their main technologies (e.g. J2ME, Symbian, Flash Light, etc), that fits in one of the following areas:
  • Eco-Challenge
  • Emerging Markets
  • Technology Showcase
As reward for the best application, in each area, the winner will receive $25,000 (USD) and showcase the application at Mobile World Congress in Barcelona, Spain. Second place winners, also in each area, will receive $10,000 and third place winners $5,000.

That's another great opportunity to show what you can do. As I said before, I will be participating in Sony Ericsson Content Awards, but if I figure something else out, why not join Nokia's one too? :)

For further information, go: http://www.callingallinnovators.com/home.asp

See you in the next post...