tag:blogger.com,1999:blog-56583883095943721462024-03-14T06:52:34.154-03:00J2ME GroupThis is the blog of J2ME Group on LinkedIn, which is intended to professionals, developers and enthusiasts that want to expand and share their knowledge and experience on this outstanding platform for mobile applications development.Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.comBlogger99125tag:blogger.com,1999:blog-5658388309594372146.post-14070994203693432932016-06-16T10:20:00.000-03:002016-06-16T10:20:02.159-03:00Moving to GitHubHi, all<br />
<br />
It's been awhile since my last post. Today I am just stopping by to drop a quick update about my open source projects, which I talked a lot here in the blog.<br />
<br />
In case you don't know, <a href="https://kenai.com/" target="_blank"><b>Project Kenai</b></a> and <a href="http://java.net/" target="_blank"><b>Java.net</b></a> are shutting down on next Apr 28th, 2017. So everybody that has any project hosted on these sites will have to move it to somewhere else. All my open source projects are there, so it's time to find a new home: <a href="https://github.com/emobtech" target="_blank"><b>GitHub</b></a>.<br />
<br />
GitHub is now the most used projects repository on the web, because of their great features, e.g. collaborative development. So it seems a good fit.<br />
<br />
Unfortunately, I am no longer maintaining those projects due to lack of time and focus on other things. However, I expect that GitHub's collaborative enviroment may encourage developers that still work with theses projects to contribute to keep them alive.<br />
<br />
Find below the direct links to the projects:<br />
<br />
<ul>
<li><a href="https://github.com/emobtech/AdME" target="_blank">AdME</a></li>
<li><a href="https://github.com/emobtech/FacebookAPIME" target="_blank">Facebook API ME</a></li>
<li><a href="https://github.com/emobtech/GoogleAnalyticsME" target="_blank">Google Analytics ME</a></li>
<li><a href="https://github.com/emobtech/NetworkingME" target="_blank">Networking ME</a></li>
<li><a href="https://github.com/emobtech/PullDownRefreshME" target="_blank">PullDownRefreshME</a></li>
<li><a href="https://github.com/emobtech/TwitterAPIME" target="_blank">Twitter API ME</a></li>
<li><a href="https://github.com/emobtech/UserInterfaceME" target="_blank">User Interface ME</a></li>
</ul>
<div>
Count on you guys!</div>
<div>
<br /></div>
<div>
See you in the next post...</div>
Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com27tag:blogger.com,1999:blog-5658388309594372146.post-11350659896544751342014-02-12T14:51:00.000-03:002014-02-12T14:51:17.479-03:00StocksMe: Development NotesHi, all<br />
<br />
<a href="http://2.bp.blogspot.com/-o5uVhW_wHpI/UvuzMvq4bUI/AAAAAAAAC1I/UWUEyILS5pQ/s1600/stocksne_quotelist.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://2.bp.blogspot.com/-o5uVhW_wHpI/UvuzMvq4bUI/AAAAAAAAC1I/UWUEyILS5pQ/s1600/stocksne_quotelist.png" height="200" width="150" /></a>It is a great pleasure that I am here again to launch my newest app for the <a href="http://developer.nokia.com/asha" target="_blank"><b>Nokia Asha platform</b></a>, called <b>StocksMe</b>, and share with you some technical details involving its development.<br />
<br />
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.<br />
<br />
StocksMe is available for download from the <a href="http://store.ovi.com/content/337188" target="_blank"><b>Nokia Store</b></a>, for a price of $1.99.<br />
<br />
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 <a href="http://dancounsell.com/articles/paid-paymium-or-freemium" target="_blank">article</a>'s fault. :)<br />
<br />
Well... Now to the point that is the focus of this blog: development.<br />
<br />
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.<br />
<br />
The development environment was the <b><a href="http://developer.nokia.com/asha/java" target="_blank">Nokia Asha SDK 1.1</a></b>, <b>Nokia IDE for Java ME</b> (based on Eclipse) and <b>Nokia Asha 502 Emulator</b>. 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.<br />
<br />
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.<br />
<br />
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 <a href="http://developer.nokia.com/devices/device-specifications/nokia-asha-502" target="_blank">Nokia Asha 502</a>, I ended up performing the tests on my <a href="http://developer.nokia.com/devices/device-specifications/nokia-asha-501" target="_blank">Nokia Asha 501</a>.<br />
<br />
Speaking of app's architecture, StocksMe’s is practically the same as <b><a href="http://store.ovi.com/content/391482" target="_blank">CurrencyMe</a></b>’s, which we <a href="http://j2megroup.blogspot.com.br/2013/09/currencyme-power-of-nokia-asha-platform.html" target="_blank">talked about</a> a while ago. It is based on the traditional <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller" target="_blank">MVC</a>. For those who want to take a better look at this architecture, I suggest you to download CurrencyMe’s <a href="http://cl.ly/391C3O430e3p" target="_blank">source code</a>.<br />
<br />
For the user interface, again opted by <b><a href="http://developer.nokia.com/resources/library/Asha_UI/building-blocks-lwuit.html" target="_blank">LWUIT for S40</a></b>, 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.<br />
<br />
Specifically in this app, I used for the first time <b>SearchBar</b> 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.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-sZsKC_5fKWY/UvuzMpUEyII/AAAAAAAAC1Y/AKvCHZYHXzc/s1600/stocksme_searchbar.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-sZsKC_5fKWY/UvuzMpUEyII/AAAAAAAAC1Y/AKvCHZYHXzc/s1600/stocksme_searchbar.png" height="149" width="200" /></a></div>
<br />
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!<br />
<br />
Another component used that is worth the registry is the <b><a href="http://j2megroup.blogspot.com.br/2013/07/pull-down-to-refresh-for-lwuit.html" target="_blank">PullDownRefresh</a></b>. 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.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-b6X9AjqlXpo/UvuzMjfj72I/AAAAAAAAC1Q/9B9n07waFyk/s1600/stocksme_pulldown.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-b6X9AjqlXpo/UvuzMjfj72I/AAAAAAAAC1Q/9B9n07waFyk/s1600/stocksme_pulldown.png" height="126" width="200" /></a></div>
<br />
PullDownRefresh v1.1 was developed during the development of StocksMe. To learn more, read this <a href="http://j2megroup.blogspot.com.br/2014/01/pull-down-to-refresh-v11-for-lwuit.html" target="_blank">post</a>.<br />
<br />
It is also worth mentioning that Nokia has developed a similar PullDownRefresh component, <b>RefreshLoadBar</b>. 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.<br />
<br />
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 <i>UIManager</i> class, because I did not want to change the theme file that comes within the lib file.<br />
<br />
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.<br />
<br />
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.<br />
<br />
This technique dispenses the use of the <b>List</b> and <b>ListCellRenderer</b> 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.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-qAN6M3Mb37w/Uvu0DeH7R_I/AAAAAAAAC1c/u8xHHYSkdR4/s1600/stocksne_imagebuffering.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-qAN6M3Mb37w/Uvu0DeH7R_I/AAAAAAAAC1c/u8xHHYSkdR4/s1600/stocksne_imagebuffering.png" height="91" width="200" /></a></div>
<br />
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 <a href="http://developer.nokia.com/resources/library/LWUIT/lwuit-for-series-40/developers-guide/performance-considerations.html" target="_blank">topics on optimization</a>, but one caught my attention: <b>Image Buffering</b>.<br />
<br />
Image Buffering was demonstrated in <b>RLinks</b> app, which is one of the <a href="http://developer.nokia.com/resources/library/LWUIT/lwuit-for-series-40/developers-guide/example-applications.html" target="_blank">sample apps</a> 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.<br />
<br />
The result in the list of quotes was excellent! Now it scrolls pretty smooth, thus increasing the user experience.<br />
<br />
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.<br />
<br />
Speaking of data access service, once again I opted to use <b><a href="http://j2megroup.blogspot.com.br/2013/07/networking-library-for-java-me.html" target="_blank">Networking ME</a></b> project. As explained in this post, this facilitates access to data via HTTP.<br />
<br />
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 <b>CSVListener</b>, <b>JSONListener</b> and <b>ImageListener</b> (LWUIT), introduced in <a href="http://j2megroup.blogspot.com.br/2013/11/networking-me-v11-new-content-listeners.html" target="_blank">version 1.1</a>. These new listeners facilitated my life, because I did not have to worry about any content parsing.<br />
<br />
For those who want to know more about Networking ME, I suggest to stop by on the <a href="https://java.net/projects/networkingme" target="_blank">project page</a>.<br />
<br />
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 <b><a href="http://kenai.com/projects/googleanalyticsme" target="_blank">Google Analytics ME</a></b> project. However, I had a surprise this time.<br />
<br />
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.<br />
<br />
Stay tuned those who are publishing a new app or an update that this is now mandatory.<br />
<br />
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. :)<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com4tag:blogger.com,1999:blog-5658388309594372146.post-33421144534984336112014-01-30T16:25:00.000-03:002014-01-30T16:25:36.194-03:00Pull Down to Refresh v1.1 for LWUITHi, all<br />
<br />
Just to let you guys know that I just released a new version of <b><a href="http://j2megroup.blogspot.com.br/2013/07/pull-down-to-refresh-for-lwuit.html" target="_blank">Pull Down to Refresh for LWUIT</a></b>.<br />
<br />
This version brings some bug fixes and two minor features. For intance, now you can use images for "arrow" and "refresh" icons that are stored in the app's resource theme; and set an extra length for the pulling gesture, so you can calibrate when refresh should be triggered.<br />
<br />
For those that are using v1.0, you will also notice a slight behavior change in the component. Now by default, it is always visible. On the other hand, you can make it always hidden as well. There is new constructor that makes it possible.<br />
<br />
You can download the new component's version by clicking <a href="https://kenai.com/projects/uime/downloads/download/PullDownRefreshMIDlet-v11.zip" target="_blank">here</a>.<br />
<br />
It is worth mentioning that PullDownRefresh is under MIT license.<br />
<br />
Enjoy the update!<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com0tag:blogger.com,1999:blog-5658388309594372146.post-50178008960353769362013-11-20T16:47:00.000-03:002013-11-20T16:47:24.469-03:00Networking ME v1.1: URLLabel and URLButton for LWUITHi, all<br />
<br />
Continuing our two-parts introduction post about the news in <a href="https://java.net/projects/networkingme" target="_blank"><b>Networking ME v1.1</b></a>.<br />
<br />
In the first post, we introduced the <a href="http://j2megroup.blogspot.com.br/2013/11/networking-me-v11-new-content-listeners.html" target="_blank">new content listeners</a>. Now in this second one, we will show you three <a href="https://lwuit.java.net/" target="_blank">LWUIT</a> components built on top of the library: <b>ImageListener</b>, <b>URLLabel</b> and <b>URLButton</b>.<br />
<br />
<b>ImageListener</b> class is a content listener for LWUIT Image. Such as the class name, It works same as the ImageListener class for LCDUI Image. <i>(This component could have been introduced in the fist post, but I decided to talk about it here, since this post is focused on LWUIT)</i><br />
<br />
<pre>...
URL url = new URL("http://www.emobtech.com/images/pic.png");
HttpRequest req = new HttpRequest(url);
//
RequestOperation oper = new RequestOperation(req);
oper.start(new <b>ImageListener</b>() {
public void onImage(Image image) {
Label imgLabel = new Label(image);
//
form.addComponent(imageLabel);
}
...
});
...
</pre>
<br />
This code snippet downloads an image from an URL. The image's bytes are converted to a LWUIT Image object and then it is added to the form to be displayed. Easy, huh? So, keep reading, you will be introduced to a easier way to accomplish the same result.<br />
<br />
<pre>...
URL url = new URL("http://www.emobtech.com/images/pic.png");
<b>URLLabel</b> imageLabel = new URLLabel(url);
//
form.addComponent(imageLabel);
...
</pre>
<br />
How about this? A lot easier, right? <b>URLLabel</b> class receives an URL as parameter in a constructor and downloads the image automaticaly. Once download is down, the image is displayed. It reminds me the ease of displaying images in HTML pages, by just informing the image's URL in the "img" tag's "src" attribute.<br />
<br />
Besides the URL, URLLabel has an optional parameter that works as a placeholder, displayed while the image is downloaded. This placeholder can be either a String or Image object.<br />
<br />
Last but not least, <b>URLButton</b> class has the same features as URLLabel. Use this one in case the image you want to display is touchable.<br />
<br />
<pre>...
URL url = new URL("http://www.emobtech.com/images/pic.png");
<b>URLButton</b> imageButton = new URLButton(url);
//
form.addComponent(imageButton);
...
</pre>
<br />
This finishes our our two-parts introduction post about the news in Networking ME v1.1. I reinforce the invitation to visit the <a href="https://java.net/projects/networkingme" target="_blank">project's website</a> and download the <a href="https://java.net/projects/networkingme/downloads/directory/Library" target="_blank">release v1.1.0</a>.<br />
<br />
Hopefully everybody has enjoyed the news.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com1tag:blogger.com,1999:blog-5658388309594372146.post-4370170114216075992013-11-20T09:52:00.000-03:002013-11-20T09:52:25.022-03:00Networking ME v1.1: New Content ListenersHi, all<br />
<br />
I would like to announce that <a href="https://java.net/projects/networkingme" target="_blank"><b>Networking ME v1.1</b></a> has been released. Networking ME is a feature-rich networking library for Java ME platform. This new version comes with interesting and useful features that will make developers' life easier.<br />
<br />
I will split this introduction into two posts: This first one, I will talk about the new content listeners. Second one, I will introduce some new components specifically designed for LWUIT.<br />
<br />
Networking ME comes with new content listener for parsing contents, i.e, CSV, XML and JSON. See below some code snippets:<br />
<br />
<pre>...
URL url = new URL("http://www.emobtech.com/csv/file.csv");
HttpRequest req = new HttpRequest(url);
//
RequestOperation oper = new RequestOperation(req);
oper.start(new <b>CSVListener</b>() {
public void onCSV(String[][] csv) {
String name = csv[0][1];
String email = csv[0][2];
}
...
});
...
</pre>
<br />
<b>CSVListener</b> class delivers a <a href="http://en.wikipedia.org/wiki/Comma-separated_values">CSV</a> content parsed to a String matrix, where it is possible to navigate through the lines and columns.
<br />
<br />
<pre>...
URL url = new URL("http://www.emobtech.com/xml/file.xml");
HttpRequest req = new HttpRequest(url);
//
RequestOperation oper = new RequestOperation(req);
oper.start(new <b>SAXListener</b>(new UserHandler()) {
public void onSAX(DefaultHandler handler) {
User[] users = ((UserHandler)handler).getParsedUsers();
}
...
});
...
</pre>
<br />
<b>SAXListener</b> class uses the <a href="http://en.wikipedia.org/wiki/Simple_API_for_XML"><b>Simple API for XML</b> (</a><b><a href="http://en.wikipedia.org/wiki/Simple_API_for_XML">SAX)</a> </b>implementation, from <a href="http://jcp.org/en/jsr/detail?id=172" target="_blank"><b>JSR 172</b></a>, to deliver a <a href="http://en.wikipedia.org/wiki/XML">XML</a> content parsed to a handler object, which holds the content.
<br />
<br />
<pre>...
URL url = new URL("http://www.emobtech.com/json/file.json");
HttpRequest req = new HttpRequest(url);
//
RequestOperation oper = new RequestOperation(req);
oper.start(new <b>JSONListener</b>() {
public void onJSON(JSONObject jsonObject) {
String value = jsonObject.get("key");
}
...
});
...
</pre>
<br />
<b>JSONListener</b> class uses the <b><a href="http://www.json.org/">JSON.org</a></b> <b>Parser</b> implementation, to deliver a <a href="http://en.wikipedia.org/wiki/JSON">JSON</a> content parsed to a JSONObject object, where it is possible to access all keys, values, arrays, etc. In case you need, in the release package, you can find the JSON.org jar file in the lib folder.<br />
<br />
Networking ME also provides other content listeners from previous versions, i.e, <b>TextListener</b>, <b>BinaryListener</b> and <b>ImageListener</b> (for LCDUI).<br />
<br />
That's it! I invite everybody to visit the <a href="https://java.net/projects/networkingme">project's website</a>, check out more code snippets about the other features and - why not? - to download the <a href="https://java.net/projects/networkingme/downloads/directory/Library">release v1.1.0</a>. By the way, it is always good to mention, Networking ME is under <a href="http://opensource.org/licenses/MIT">MIT</a>.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com0tag:blogger.com,1999:blog-5658388309594372146.post-1849169760389142902013-09-27T09:45:00.001-03:002013-09-27T09:45:20.589-03:00CurrencyMe: The Power of Nokia Asha PlatformHi, all<br />
<br />
<a href="http://2.bp.blogspot.com/-X-PWQppbtBE/Ujj3EB4EqjI/AAAAAAAACyk/dekdXpd9Hjg/s1600/screenshot.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="http://2.bp.blogspot.com/-X-PWQppbtBE/Ujj3EB4EqjI/AAAAAAAACyk/dekdXpd9Hjg/s200/screenshot.png" width="150" /></a>Today I would like to announce my new app <b><a href="http://store.ovi.com/content/391482" target="_blank">CurrencyMe</a>:</b> the perfect tool to follow over 30 currencies rates in real-time.<br />
<br />
Based on your local currency, the app displays the conversion rate to other currencies. Pretty useful tool for investors or travellers.<br />
<br />
CurrencyMe was developed in order to show off the power of new <a href="http://developer.nokia.com/Develop/asha/" target="_blank"><b>Nokia Asha Platform</b></a>, currently represented by the device <b><a href="http://developer.nokia.com/Devices/Device_specifications/Asha_501/" target="_blank">Nokia Asha 501</a></b>.<br />
<br />
Asha Platform is built on top of CLDC 1.1 and MIDP 2.1.<br />
<br />
Regarding user interface, there is a tailored version of <a href="http://developer.nokia.com/Resources/Library/Asha_UI/#!index.html" target="_blank">LWUIT</a>, which brings interesting new components. LCDUI can also be used.<br />
<br />
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.<br />
<br />
See below the list of all components X features:<br />
<b><br /></b>
<b>PopupChoiceGroup</b>: 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.<br />
<br />
<b>FormItem</b>: 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.<br />
<br />
<b>HeaderBar</b>: 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.<br />
<br />
<b>GroupHeader</b>: 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.<br />
<br />
<b>Switch</b>: 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.<br />
<br />
<b>LocaleManager</b>: 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.<br />
<br />
<b>Formatter</b>: 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.<br />
<br />
<b>Network State Changes</b>: 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.<br />
<br />
Besides all these new components, other libraries were used as well:<br />
<br />
CurrencyMe is integrated to <b><a href="http://developer.nokia.com/Distribute/NAX/" target="_blank">Nokia Ad Exchange</a></b>, a private mobile advertising exchange offering access to the top ad networks in the world. It was very is get the app integrated.<br />
<br />
<b><a href="https://java.net/projects/networkingme/pages/Home" target="_blank">Networking ME</a></b>, a networking library for Java ME platform, was used to implement the access to currency rates service.<br />
<br />
To collect data about app's usage and send data to Google Analytics, <b><a href="https://kenai.com/projects/googleanalyticsme/pages/Home" target="_blank">Google Analytics ME</a></b> was used for this task.<br />
<br />
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 <a href="http://opensource.org/licenses/gpl-license" target="_blank">GPL</a>. There are some good reusable components to work with Record Store, NAX, GA, etc. For these ones, <a href="http://opensource.org/licenses/MIT" target="_blank">MIT</a> license is applied.<br />
<br />
To download the source code, click <a href="http://cl.ly/391C3O430e3p" target="_blank">here</a>!<br />
<br />
Hopefully you guys enjoy the app and the source code.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com1tag:blogger.com,1999:blog-5658388309594372146.post-81248137255499199832013-07-19T22:21:00.000-03:002014-02-17T10:18:07.911-03:00Pull Down to Refresh for LWUITHi, all<br />
<br />
<a href="http://3.bp.blogspot.com/-ZLVXEZfU8ks/UenjOK-X0yI/AAAAAAAACxM/Mv84ZigdQZY/s1600/PullDownRefresh.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://3.bp.blogspot.com/-ZLVXEZfU8ks/UenjOK-X0yI/AAAAAAAACxM/Mv84ZigdQZY/s200/PullDownRefresh.png" height="200" width="150" /></a>I believe most of you here have heard about <b>"<a href="http://www.usabilitypost.com/2010/07/21/pull-down-to-refresh/" target="_blank">Pull Down to Refresh</a>"</b> gesture. Shortly, it is a very used gesture on iOS apps, created by <b><a href="https://twitter.com/lorenb" target="_blank"><span id="goog_839732534"></span>Loren Brichter<span id="goog_839732535"></span></a></b>, which users perform to refresh contents on the screen, just pulling down a list using the thumb.<br />
<br />
So, now that you are contextualized about "Pull Down Refresh", I would like to inform that this famous gesture has just arrived to Java ME/LWUIT world.<br />
<br />
<b>Pull Down to Refresh for LWUIT</b> was an old idea of mine, but just this week I sat down and decided to code a component that implemented this gesture. I was not sure whether it was going to work, but for my surprise it worked, and you will see how easy it is to get it integrated into your apps.
<br />
<br />
<pre name="java">...
Form form = new Form("PullDownRefresh") {};
form.setLayout(new BorderLayout());
//
List list = new List(new String[] {...});
list.setRenderer(new DefaultListCellRenderer());
//
final <b>PullDownRefresh refresher</b> = new PullDownRefresh();
refresher.<b>addActionListener</b>(new ActionListener() {
public void <b>actionPerformed</b>(ActionEvent evt) {
new Thread() {
public void run() {
// Perform some process
//
<b>refresher.endRefreshing()</b>;
}
}.start();
}
});
//
form.<b>addComponent</b>(BorderLayout.NORTH, <b>refresher</b>);
form.addComponent(BorderLayout.CENTER, list);
//
form.show();
...
</pre>
<br />
As you can see in the code snippet above, all you have to do is to create an instance of PullDownRefresh class and add it at first position of a Form object and register an ActionListener object to be notified when a refresh operation is triggered. With this notification, you can start a process to perform any operation, e.g., refresh the Form's data. Once the operation is concluded, just call the endRefreshing() method, so the component can return to its default state. Easy, huh?<br />
<br />
Watch the video below and see PullDownRefresh component in action:
<br />
<br />
<div align="center">
<iframe allowfullscreen="" frameborder="0" height="315" src="//www.youtube.com/embed/NqrpJi_02RE" width="420"></iframe>
<br />
<br />
Cool, huh? :)</div>
<br />
PullDownRefresh component is totally customizable. For instance, you can change the style, images and labels. Check out the Javadoc and you will know how.<br />
<br />
You can download the component right away by clicking <a href="https://kenai.com/projects/uime/downloads/download/PullDownRefreshMIDlet.zip" target="_blank">here</a>. Besides the source code, there is also sample MIDlet.<br />
<br />
By the way, PullDownRefresh is under <a href="http://opensource.org/licenses/MIT" target="_blank">MIT</a> license.<br />
<br />
I hope everybody finds this new component useful and let me know your comments.<br />
<br />
See you in the next post...<br />
<br />
<b>Update (Feb 17th, 2014):</b><br />
<br />
There is a new version of this component. For further details, check this <a href="http://j2megroup.blogspot.com.br/2014/01/pull-down-to-refresh-v11-for-lwuit.html">post</a>.Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com24tag:blogger.com,1999:blog-5658388309594372146.post-7290125422125819252013-07-12T18:00:00.001-03:002013-07-12T18:00:51.175-03:00Networking Library for Java ME: Networking MEHi, all<br />
<br />
One more time, it is a pleasure for me to announce another project of mine for this amazing platform: <b><a href="https://java.net/projects/networkingme" target="_blank">Networking ME</a></b>.<br />
<br />
Networking ME is a networking library for Java ME platform. It's built on top of <a href="http://www.oracle.com/technetwork/systems/index-155711.html" target="_blank">Generic Connection Framework</a> and other foundation technologies. It has a modular architecture with well-designed, feature-rich APIs that are easy to use.<br />
<br />
For this initial release, I focused on <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">HTTP</a> connections, which notoriously is the most used protocol by internet services nowadays, because of its versatility and interoperability.<br />
<br />
To work with HTTP connections in Java ME is not complicated itself, as you may know. On the other hand, it requires a good number of lines of code to make things happen, e.g., start a new thread, handle exceptions (either I/O or security), parse the result response, etc. Besides, there are some lack of features, e.g., session management, cookie tracking, URL redirect, etc. Because of these matters, I decided to develop Networking ME and make mine and developers' life easier.<br />
<br />
Networking ME was created based on some codes of mine, which I used to implement the same tasks mentioned above in some apps that I worked on. Finally, I have decided to compile them all in a library, so my future apps and other developers could use them as well.
<br />
<br />
Stop talking and show me the code!, you may be thinking. :) Alright, here it goes:<br />
<br />
<pre name="java">...
URL url = new URL("http://www.emobtech.com");
HttpRequest req = new HttpRequest(url);
//
RequestOperation oper = new RequestOperation(req);
oper.start(new TextListener() {
public void onText(String text) {
System.out.println(text);
}
public void onFailure(Request req, RequestException e) {
System.out.println(exception.getMessage());
}
});
...
</pre>
<br />
Easy and clean, huh?<br />
<br />
The code above shows a basic HTTP request. In the project's Wiki you will find more example usages, e.g. download image, POST data, upload file, etc. It is just an appetizer.<br />
<br />
In terms of requirements, Networking ME is implemented using MIDP 2.0 and CLDC 1.0. That's pretty much what all Java ME devices available in the market support at least.<br />
<br />
That's it! I invite everybody to visit the <a href="https://java.net/projects/networkingme" target="_blank">project's website</a> and take a look at everything and download the <a href="https://java.net/projects/networkingme/downloads/directory/Library" target="_blank">release v1.0.0</a>. By the way, Networking ME is under <a href="http://opensource.org/licenses/MIT" target="_blank">MIT</a>.<br />
<br />
I am really excited about this new project and I hope everybody like and find it useful.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com3tag:blogger.com,1999:blog-5658388309594372146.post-12920696911043672342013-06-05T16:46:00.000-03:002013-06-06T13:51:48.649-03:00UI Components for Java MEHi, all<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://sites.google.com/site/uicomponents4jme/grid.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="https://sites.google.com/site/uicomponents4jme/grid.JPG" width="166" /></a></div>
I was surfing on my web archive and I found this old page of one of my projects: <b><a href="https://sites.google.com/site/uicomponents4jme/" target="_blank">UI Components for Java ME</a></b>. I worked on this project in 2006 through 2008, I think.<br />
<br />
In this project, some UI controls were developed using LCDUI low level API. At that time - in case you don't remeber - Java ME used to suffer a lack of UI controls. We did not have <a href="http://en.wikipedia.org/wiki/Lightweight_User_Interface_Toolkit" target="_blank"><b>LWUIT</b></a> yet (2008), and only LCDUI high level controls and a few open source projects (e.g. <a href="http://www.enough.de/products/j2me-polish/" target="_blank">J2ME Polish</a>) were available. So, we had to work hard to create rich user interfaces for our apps. That was one of the motivations that made work on this project.<br />
<br />
Below a list of some UI controls developed:<br />
<br />
List, Detail List, Grouped List, Grid (my favorite one!), DocList, Form, TextField, CheckBox, RadioButton, Calendar, Image Viewer, Text Box, etc.<br />
<br />
Besides UI controls, there are a lot of utility classes that were developed alongside: Download Manager, RMS, Feed Reader, String functions, Object serialization, etc.<br />
<br />
This project's source code is open and is available for everybody. You guys can check it out from <a href="https://kenai.com/projects/uime" target="_blank">here</a>.<br />
<br />
I hope it is stil usefull for someone.<br />
<br />
See you in the next post...<br />
<br />
<b>Update on June 6th, 2013</b><br />
<br />
I created a package that contains all source code, lib, javadoc and binary.<br />
<br />
You can download it from <a href="https://kenai.com/projects/uime/downloads/download/uime-v1.0.0.zip" target="_blank">here</a>.<br />
<br />
It is also worth noting that there are some sample MIDlets that show how to use the controls. You can find them inside the package <i>com.emobtech.uime.samples</i>.Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com0tag:blogger.com,1999:blog-5658388309594372146.post-43099552206050124362013-02-26T14:38:00.001-03:002013-02-26T14:38:58.844-03:00TwAPIme updated to Twitter API v1.1Hi, all<br />
<br />
Yesterday I uploaded a beta version of one my projects, <b><a href="http://kenai.com/projects/twitterapime" target="_blank">Twitter API ME v1.9</a></b>. This version does not bring any new feature, but updates the project due to the <a href="https://dev.twitter.com/blog/changes-coming-to-twitter-api" target="_blank">changes</a> in Twitter API v1.1.<br />
<br />
The idea behind publishing an ealier build for the developers, is to give them a chance to test their apps as soon as possible. Any feedback is welcome! Here is the forum's <a href="http://kenai.com/projects/twitterapime/forums/forum/topics/532732-Twitter-API-ME-1-9-updated-to-Twitter-API-v1-1-available-for-beta-testers-" target="_blank">link</a>.<br />
<br />
It is important to point out that Twitter API v1.0 will be shut down on March 5th... so TwAPIme v1.8 and older will stop working as well.<br />
<br />
The download link is <a href="http://kenai.com/projects/twitterapime/downloads/download/1.9/twitter_api_me-1.9-beta.zip" target="_blank">here</a>.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com0tag:blogger.com,1999:blog-5658388309594372146.post-51970436597059797252013-02-25T17:07:00.000-03:002013-02-25T17:07:50.537-03:00Multiple HTTP Headers for S40: Fixed!Hi, all<br />
<br />
Long time since last time, hah? Sorry! Quite busy!<br />
<br />
Back in 2011 we reported a <a href="http://j2megroup.blogspot.com.br/2011/12/multiple-http-headers-no-cookie-for-you.html" target="_blank">problem</a> on Nokia S40 platform. That time I would like to be able to access multiple HTTP headers of the same type, i.e. <b>Set-Cookie</b>. 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.<br />
<br />
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.<br />
<br />
<i><span style="color: #999999;"><a href="http://www.developer.nokia.com/Community/Wiki/KIJ000854_-_Multiple_HTTP_headers_of_the_same_type_cannot_be_handled" target="_blank">Skalogir - Update 16th of August 2012</a></span></i><br />
<i><span style="color: #999999;"><br /></span></i>
<i><span style="color: #999999;">This issue is still present and affects both Symbian and Series 40 devices. After extensive hands on testing, I have updated the categories. <u><b>The error is fixed on S60 5th Edition and Series 40 Developer Platform 2.0.</b></u> Any previous platforms are affected by this.</span></i><br />
<span style="color: #999999;"><i><br /></i></span>
Great, isn't it? I tried it out and it really works. Finally, I was able to implement my feature the way I wanted.<br />
<br />
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.<br />
<br />
One more time, thanks Nokia.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com0tag:blogger.com,1999:blog-5658388309594372146.post-63866901143140785022012-07-06T09:56:00.001-03:002012-07-06T09:56:34.081-03:00New version of Google Analytics ME v2.1Hi, all<br />
<br />
Today, I would like to announce that <b><a href="http://kenai.com/projects/googleanalyticsme" target="_blank">Google Analytics ME</a></b> v2.1 has been released. This new version comes with important fixes. See them below:<br />
<br />
- Fixed issue that was not identifing properly unique visitors.<br />
- Improved session counter and visit duration calculation.<br />
- Assign a custom user agent throught the JAD property "GAME-Custom-UserAgent".<br />
<br />
It is important to point out that this new version will reset a cookie that is installed in your app by the API to track the user. This was necessary, since its structure had to be changed. So, don't worry when new unique users appear in your reports, when your users start updating their apps. From now on, they will be unique for sure.<br />
<br />
Use the new JAD property <b>"GAME-Custom-UserAgent"</b> to customize the user agent that your app sends to Google Analytics. For instance, this can help you identify properly from which devices users are running your app.<br />
<br />
I would like to thank <b>Ramesh Sudini</b> from <a href="http://www.saavn.com/" target="_blank">SAAVN</a> for your contribution in this release.<br />
<br />
To download the API, click <a href="http://kenai.com/projects/googleanalyticsme/downloads/download/googleanalytics-me-2.1-javame.zip" target="_blank">here!</a> By the way, inside the package there is a sample app for reference.<br />
<br />
<span style="background-color: white;">Hopefully, everybody enjoy it!</span><br />
<br />
<span style="background-color: white;">See you in the next post...</span>Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com1tag:blogger.com,1999:blog-5658388309594372146.post-26749909982001095782012-06-28T10:41:00.000-03:002012-06-28T10:41:49.388-03:00LWUIT for Series S40Hi, all<br />
<br />
Nokia has done a great job on its <a href="http://www.developer.nokia.com/Devices/Device_specifications/?filter1=all&filter2=s40" target="_blank"><b>Series S40</b></a>! 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 <a href="http://www.developer.nokia.com/Devices/Device_specifications/Asha_303/" target="_blank">Asha 303</a>, <a href="http://www.developer.nokia.com/Devices/Device_specifications/X3-02/" target="_blank">X3-02</a> and <a href="http://www.developer.nokia.com/Devices/Device_specifications/C3-00/" target="_blank">C3-00</a>, and I liked the result!<br />
<br />
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. <a href="http://www.developer.nokia.com/Develop/Maps/Maps_API_for_Java_ME/" target="_blank">Maps API</a> (you gotta check out this one!) and I<a href="http://www.developer.nokia.com/Distribute/In-app_purchasing/" target="_blank">n-App Purchasing</a>, and Nokia IDE (Eclipse-based) and many other tools. <span style="background-color: white;">Nokia is now releasing its </span><a href="http://www.developer.nokia.com/Develop/Java/?utm_medium=email&utm_source=peer360&utm_campaign=eDMS40ToolsJune2012?utm_content=eDMS40toolsJune2012" style="background-color: white;" target="_blank"><b>SDK 2.0</b></a><span style="background-color: white;"> for Series S40</span><span style="background-color: white;">, along with new devices: Asha </span><a href="http://www.developer.nokia.com/Devices/Device_specifications/Asha_305/?utm_medium=email&utm_source=peer360&utm_campaign=eDMS40ToolsJune2012?utm_content=eDMS40toolsJune2012" style="background-color: white;" target="_blank">305</a><span style="background-color: white;">, </span><a href="http://www.developer.nokia.com/Devices/Device_specifications/Asha_306/?utm_medium=email&utm_source=peer360&utm_campaign=eDMS40ToolsJune2012?utm_content=eDMS40toolsJune2012" style="background-color: white;" target="_blank">306</a><span style="background-color: white;"> and </span><a href="http://www.developer.nokia.com/Devices/Device_specifications/Asha_311/?utm_medium=email&utm_source=peer360&utm_campaign=eDMS40ToolsJune2012?utm_content=eDMS40toolsJune2012" style="background-color: white;" target="_blank">311</a><span style="background-color: white;">. All of them now full touch. </span><span style="background-color: white;"><br /><br />Now let's stick to the post's title.</span><br />
<a href="http://projects.developer.nokia.com/LWUIT_for_Series_40/raw-attachment/wiki/WikiStart/LWUITDemo.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="http://projects.developer.nokia.com/LWUIT_for_Series_40/raw-attachment/wiki/WikiStart/LWUITDemo.png" width="150" /></a><br />
<span style="background-color: white;">Taking the opportunity of the launch of its new SDK, Nokia is also releasing <a href="http://projects.developer.nokia.com/LWUIT_for_Series_40?utm_medium=email&utm_source=peer360&utm_campaign=eDMS40ToolsJune2012?utm_content=eDMS40toolsJune2012" target="_blank"><b>LWUIT for Series 40</b></a>, 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. </span><span style="background-color: white;">LWUIT for S40 can be used to create applications targeted at Series 40 5th Edition and newer devices.</span><br />
<br />
<span style="background-color: white;">This optmization has provided some notable changes on LWUIT components (e.g. </span><span style="background-color: white;">Form, List, TextArea, TextField, etc</span><span style="background-color: white;">) 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!</span><br />
<br />
<span style="background-color: white;">You can find all those changes and other useful information, e.g. installation and other resources, about LWUIT for S40 in this </span><a href="http://projects.developer.nokia.com/LWUIT_for_Series_40/wiki/WikiStart" style="background-color: white;" target="_blank">Wiki</a><span style="background-color: white;"> page.</span><br />
<br />
<span style="background-color: white;">The link to donwload is <a href="http://projects.developer.nokia.com/LWUIT_for_Series_40/downloads/15" target="_blank">here</a>.</span><br />
<br />
<span style="background-color: white;">Nokia, thanks for boosting Java ME for real.</span><br />
<br />
<span style="background-color: white;">See you in the next post...</span>Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com0tag:blogger.com,1999:blog-5658388309594372146.post-78311624024146360192012-05-14T13:56:00.001-03:002012-05-14T13:59:08.657-03:00The Death of RIM: The fall of a big Java ME playerHi, all<br />
<br />
Check out this interesting infographic about RIM's trajectory from top to the bottom. It is a sad picture of a big company and a big Java ME player as well.<br />
<br />
I hope you guys enjoy it.<br />
<br />
See you in the next post...<br />
<br />
<a href="http://www.mbaonline.com/death-of-rim/"><img alt="Death of RIM" border="0" src="http://images.mbaonline.com.s3.amazonaws.com/death-of-rim.gif" width="470" /></a><br />
Created by: <a href="http://www.mbaonline.com/" target="_blank">MBAOnline.com</a>Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com0tag:blogger.com,1999:blog-5658388309594372146.post-43649536451052881582012-01-03T09:36:00.000-03:002012-01-03T09:36:11.045-03:00Google Analytics ME v2.0: Unique visitorsHi, all<br />
<br />
Today, I would like to announce that <b>Google Analytics ME v2.0</b> has been released. This new version comes with some good news and important changes. See them below:<br />
<br />
- Identification of unique visitors.<br />
- Better visitor's features identification.<br />
- Small code refactoring.<br />
- Android support deprecated.<br />
<br />
<b>Identification of unique visitors</b><br />
<br />
Now GAN ME identifies properly who is a new visitor or not. This way, your visitors report is 100% accurate about the number of new and old visitors.<br />
<br />
<b>Better visitor's features identification</b><br />
<br />
More visitor's features are being collected by GAN ME. For instance, now the app's name, version, screen size and number of colors are being collected.<br />
<br />
<b>Small code refactoring</b><br />
<br />
To implement some of the new features and fix some of the bugs, some code changes were required, which may cause some compilation errors for your app. But it is not a big deal from developer's view. Actually, most developers will just have to fix the call to Tracker.getInstance(), which now requires to pass the MIDlet instance as well as the GAN app Id.<br />
<br />
<b>Android support deprecated</b><br />
<br />
From this version on, we decided to deprecate the Android support. It turns out that there is already an official <a href="http://goo.gl/8Qm2b" target="_blank">GAN API for Android</a>, built by Google. So, we strongly recommend you to use that one in your Android app. It is very good!<br />
<br />
I hope everybody enjoy this new version. Let me know your feedback.<br />
<br />
To download the API, click <a href="http://kenai.com/projects/googleanalyticsme/downloads" target="_blank">here!</a> By the way, inside the package there is a sample app for reference.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com6tag:blogger.com,1999:blog-5658388309594372146.post-30239018748953267742011-12-06T09:31:00.000-03:002011-12-06T09:31:39.960-03:00Multiple HTTP Headers: No cookie for youHi, all<br />
<br />
As you may know, <a href="http://en.wikipedia.org/wiki/HTTP_cookie" target="_blank">HTTP Cookies</a> 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.<br />
<br />
Unfortunately, this session management must be handled by the developer, since <i>HttpConnection</i> 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 <a href="http://www.developer.nokia.com/Community/Wiki/Session_management_in_Java_ME" target="_blank">here</a>.<br />
<br />
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.<br />
<br />
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:<br />
<br />
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 <a href="http://www.developer.nokia.com/Community/Wiki/KIJ000854_-_Multiple_HTTP_headers_of_the_same_type_cannot_be_handled" target="_blank">does not support multiple HTTP header</a>. It means that two cookie cannot be handled, because only one is available. Nice, hah?<br />
<br />
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.<br />
<br />
W.O.R.A does not work so well on mobile devices.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com0tag:blogger.com,1999:blog-5658388309594372146.post-58471303249985026662011-10-06T23:02:00.000-03:002011-10-06T23:02:22.886-03:00Twitter API ME 1.8: Now with OAuth supportHi, all<br />
<br />
It's been a long time since my last post, but besides being a little bit busy, I also took a vacation, enjoying a trip to US, to visit some old friends. Great trip, by the way. But now, let's get back to work!<br />
<br />
One thing that kept me busy during this time was the implementation of <b><a href="http://kenai.com/projects/twitterapime" target="_blank">Twitter API ME 1.8</a></b>. This new version is very special, because it comes with full support to <a href="https://dev.twitter.com/docs/auth/oauth" target="_blank"><b>OAuth</b></a>. Since Twitter changed its <a href="https://dev.twitter.com/docs/application-permission-model" target="_blank">Application Permission Model</a>, requiring apps to use OAuth to have access to user's direct messages, Twitter API ME developers were not longer able to access DMs from their apps. Before v1.8, only <a href="https://dev.twitter.com/docs/oauth/xauth" target="_blank">xAuth</a> was supported.<br />
<br />
Other great thing about OAuth is that developers will no longer need to request xAuth permission to Twitter for their apps keys, in order to start working with the API. Since OAuth flow is more secure, Twitter trusts promptly any registered app, because there is no way for apps to get access to user's password. So, no more you have to wait days or until your app is done, so Twitter decides to grant you permission.<br />
<br />
It is also important to point out, OAuth is available for all platforms supported: Java ME, Android and RIM.<br />
<br />
Besides OAuth, Twitter API ME 1.8 comes with other news:<br />
<br />
- Possibility to configure additional connection parameters for RIM platform.<br />
- Improved RIM connection string solving the issue of when the devices is subscribed to BIS.<br />
- Geo-located Trend search based on <a href="http://developer.yahoo.com/geo/geoplanet/" target="_blank">Yahoo! Where On Earth ID</a>.<br />
- Bug fixes and replacement of some deprecated Twitter API's resources.<br />
<br />
I am really glad to have one more version of this successful project released. In addition, I would also like to thank everybody that contributed with the project, reporting bugs and requesting new features through our <a href="http://kenai.com/projects/twitterapime/pages/ExpressSupport" target="_blank">Express Support</a>.<br />
<br />
I strongly recommend you to migrate to v1.8 right away. So, download it now from <a href="http://kenai.com/projects/twitterapime/downloads/directory/1.8" target="_blank">here</a>. I also prepared some sample apps to help developers to understand how to integrate OAuth into their apps. Just click <a href="http://kenai.com/projects/twitterapime/downloads/directory/Miscellaneous" target="_blank">here</a> and have fun.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com9tag:blogger.com,1999:blog-5658388309594372146.post-49143719669063952912011-06-20T08:55:00.000-03:002011-06-20T08:55:55.247-03:00Facebook API ME for AndroidHi, all<br />
<br />
Continuing the announcements on Facebook API ME, yesterday, I released <b><a href="http://kenai.com/projects/facebookapime" target="_blank">Facebook API ME</a></b> v1.0 for <b>Android</b>. This version uses <b><a href="http://developer.android.com/reference/android/webkit/WebView.html" target="_blank">WebView</a></b> component from Android API to display the authentication page. As I explained in this <a href="http://j2megroup.blogspot.com/2011/06/facebook-api-me-10-tutorial.html" target="_blank">tutorial</a>, to use the API for other platforms, you just need to work with the respective wrapper class for the target platform. Regarding Android, you will have to use <b><i>WebViewAuthDialogWrapper</i></b>.<br />
<br />
<i>...</i><br />
<i>WebView webView = ...;</i><br />
<br />
<i>AuthDialogWrapper pageWrapper = </i><br />
<i> new </i><i>WebView</i><i>AuthDialogWrapper(</i><i>webView</i><i>);</i><br />
<i>pageWrapper.setAppId("App Id goes here");</i><br />
<i>pageWrapper.setAppSecret("App Secret goes here");</i><br />
<i>pageWrapper.setRedirectUri("Redirect Uri goes here");</i><br />
<i>pageWrapper.setPermissions(new String[] {Permission.OFFLINE_ACCESS, Permission.PUBLISH_STREAM});</i><br />
<i>pageWrapper.addAuthenticationListener(this);</i><br />
<i>pageWrapper.login();</i><br />
<i>...</i><br />
<br />
Besides the release package, there is also a sample app demonstrating how to implement the authentication process for this platform. Here it goes the download <a href="http://kenai.com/projects/facebookapime/downloads" target="_blank">link</a>.<br />
<br />
I hope you guys enjoy it.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com3tag:blogger.com,1999:blog-5658388309594372146.post-50082059455927198902011-06-18T18:54:00.002-03:002011-06-18T18:54:44.315-03:00Facebook API ME for BlackberryHi, all<br />
<br />
This afternoon, I released <b><a href="http://kenai.com/projects/facebookapime" target="_blank">Facebook API ME</a></b> v1.0 for <b>Blackberry</b>. This version uses <b><a href="http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/browser/field2/BrowserField.html" target="_blank">BrowserField</a></b> component from RIM API to display the authentication page. As I explained in this <a href="http://j2megroup.blogspot.com/2011/06/facebook-api-me-10-tutorial.html" target="_blank">tutorial</a>, to use the API for other platforms, you just need to work with the respective wrapper class for the target platform. Regarding Blackberry, you will have to use <b><i>BrowserFieldAuthDialogWrapper</i></b>.<br />
<br />
<i>...</i><br />
<i>BrowserField browserField = ...;</i><br />
<br />
<i>AuthDialogWrapper pageWrapper = </i><br />
<i> new BrowserFieldAuthDialogWrapper(browserField);</i><br />
<i>pageWrapper.setAppId("App Id goes here");</i><br />
<i>pageWrapper.setAppSecret("App Secret goes here");</i><br />
<i>pageWrapper.setRedirectUri("Redirect Uri goes here");</i><br />
<i>pageWrapper.setPermissions(new String[] {Permission.OFFLINE_ACCESS, Permission.PUBLISH_STREAM});</i><br />
<i>pageWrapper.addAuthenticationListener(this);</i><br />
<i>pageWrapper.login();</i><br />
<i>...</i><br />
<br />
Besides the release package, there is also a sample app demonstrating how to implement the authentication process for this platform. Here it goes the download <a href="http://kenai.com/projects/facebookapime/downloads" target="_blank">link</a>.<br />
<br />
I hope you guys enjoy it.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com5tag:blogger.com,1999:blog-5658388309594372146.post-69802236644617855822011-06-10T14:40:00.000-03:002011-06-10T14:40:20.700-03:00Twitter API ME v1.7 and TwAPIme for Android App v1.0 (open source)Hi, all<br />
<br />
Today, I am proud to announce that <span style="font-weight: bold;"><a href="http://kenai.com/projects/twitterapime" target="_blank">Twitter API ME</a> v1.7</span> was finally released. This new version comes with a bunch of new functionalities, improvements and bug fixes. A special fact in this release is that all new functionalities implemented were requested by developers. All of them through our <a href="http://kenai.com/projects/twitterapime/pages/ExpressSupport"><span style="font-weight: bold;" target="_blank">Express Support</span></a>. So, thank you very much to those developers and their respective companies that contributed to this project.<br />
<br />
As I said, this version comes with a great number of news. Check them out:<br />
<br />
- Reply tweet<br />
- Timeline of favorite tweets<br />
- Favorite/unfavorite tweet<br />
- User search<br />
- User lookup<br />
- Get friends and followers (full objects, not just id)<br />
- Get friendship details between two users<br />
- New attributes in MetadataSet class<br />
- Bug fixes related to authentication using e-mail address instead of username<br />
<br />
As you can see, you will have a lot of work to integrate those new functions into your app.<br />
<br />
This version also comes with some <span style="font-weight: bold;">remarks</span>:<br />
<br />
- From this version on the release's jar file is no longer preverified for Java ME and RIM platforms. It is not necessary, because you will do that when you build your application.<br />
<br />
- You can now obfuscate your app with Twitter API ME's jar file without adding any rule to your obfuscator. No class is instantiated using reflection any more.<br />
<br />
- HTTP Basic Authentication support was completely removed from source code.<br />
<br />
Besides all those great news, there is one more thing (Apple like <img alt="Tongue" src="http://kenai.com/images/forum/tongue.png" />): <span style="font-weight: bold;">TwAPIme for Android app</span>. This an <span style="font-weight: bold;">open source</span> Twitter Android client app totally developed using Twitter API ME v1.7.<br />
<br />
I expected to publish this app on Android Market at the same time v1.7 was released, but unfortunately, for time reason, it was not possible yet. Any way, you guys may already check out this good app. I believe it will be worthy for all developers. Find below some features available in this app:<br />
<br />
- View Home, Mentions, DM and List timeline<br />
- Post Tweet<br />
- Send DM<br />
- Reply and comment tweet<br />
- Favorite/unfavorite tweet<br />
- Retweet<br />
- View user profile<br />
- View user's lists<br />
- View List's members<br />
- Follow/unfollow user<br />
- Block/unblock user<br />
- Users search<br />
- Report spammer<br />
<br />
However, it comes with an important remark that must observed by everybody: <span style="font-weight: bold;">Terms of Use</span><br />
<br />
<i>This source code is <span style="font-weight: bold;">FREE ONLY for NON-commercial</span> purposes. Actually, you can change it, add new features, fix bugs, etc. However, if you intend to release it as an app of yours, be aware it MUST be 100% FREE, besides making clear it is powered by Twitter API ME project and providing a link to website's project.</i><br />
<br />
I recommend everybody to read the READ-ME.txt file contained in the release package of Twitter API ME and TwAPIme for Android.<br />
<br />
So, here it goes the links to download the releases:<br />
<br />
Twitter API ME v1.7<br />
<a href="http://kenai.com/projects/twitterapime/downloads/directory/1.7" target="_blank">http://kenai.com/projects/twitterapime/downloads/directory/1.7</a><br />
<br />
TwAPIme for Android v1.0<br />
<a href="http://kenai.com/projects/twitterapime/downloads/directory/TwAPIme" target="_blank">http://kenai.com/projects/twitterapime/downloads/directory/TwAPIme</a><br />
<br />
So, I hope everybody enjoys all the news.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com1tag:blogger.com,1999:blog-5658388309594372146.post-39607934597189820622011-06-05T14:11:00.001-03:002011-06-07T11:16:44.476-03:00Facebook API ME 1.0: TutorialHi, all<br />
<br />
As I announced yesterday on Twitter, the first release of <b>Facebook API ME</b> is now available for <a href="http://kenai.com/projects/facebookapime/downloads" target="_blank">download</a>. Besides the release package, there is also a sample app, demonstrating how to implement the authentication process.<br />
<br />
For while, only the version for <b><a href="http://www.eclipse.org/ercp/" target="_blank">eSWT</a></b> is released. So, if your target device supports eSWT, you will be able to use this package in your Java ME app right away. I am also working on other versions targeted to <b>Blackberry</b>, <b>LWUIT</b> and <b>Android</b>. All of them are now under test phase. I hope to release them very soon. On the other hand, if you cant't wait, check out the source code from the project's <a href="http://kenai.com/projects/facebookapime/sources/facebook-api-me-rep/show" target="_blank">repository</a>. You need to add yourself to the project as an Observer member to be able to check out.<br />
<br />
Let's start the tutorial!<br />
<br />
<b>Registering an App</b><br />
<br />
You need to register an app on <b>Facebook's Developer</b> <a href="http://developers.facebook.com/" target="_blank">page</a>. The process is pretty simple and straightforward. The goal of this registration is to obtain some keys that are required by authentication process: <b>App Id</b>, <b>App Secret</b> and <b>Redirect Uri</b>. This process is very similar to Twitter's app registration process.<br />
<br />
Once you have the keys, let get to the API itself.<br />
<br />
<b>Browser Component</b><br />
<br />
In your app, you need to display Facebook's Login page, so your user can enter his credentials and then grant access to your app. This process is implemented by the API. You just need to provide a browser component instance and then the API takes care of the rest. Considering the eSWT version, you need to provide an instance of <i><a href="http://www.eclipse.org/ercp/eswt/gallery/gallery.php" target="_blank"><b>Browser</b></a></i> class.<br />
<br />
<b>Wrapper Class</b><br />
<br />
Once the browser instance is created, you have to wrap it with an instance of <i><b>AuthDialogWrapper</b></i> class. This class is responsible for managing the authentication and delegates the events to your app. Considering the eSWT version, you have to instantiate the <i><b>BrowserAuthDialogWrapper</b></i> subclass.<br />
<br />
<b>Setting Up the Keys</b><br />
<br />
The wrapper object must be set up, so it can handle the authentication process properly for you app. There are some "set" methods that can be used to inform your App Id, App Secret and Redirect Uri. If you prefer, you can enter the keys in the constructor.<br />
<br />
<i>...</i><br />
<i>Browser browser = new Browser(browserComp, SWT.TOP);</i><br />
<i><br />
</i><br />
<i>AuthDialogWrapper pageWrapper = new BrowserAuthDialogWrapper(browser);</i><br />
<i>pageWrapper.setAppId("App Id goes here");</i><br />
<i>pageWrapper.setAppSecret("App Secret goes here");</i><br />
<i>pageWrapper.setRedirectUri("Redirect Uri goes here");</i><br />
<i>...</i><br />
<br />
<b>Permissions</b><br />
<br />
Most services provided by Facebook API requires explicit authorization by user. So, during the authentication process you must inform which permissions the services that you intend to work with, must be granted by user.<br />
<br />
<i>...</i><br />
<i>pageWrapper.setPermissions(new String[] {Permission.OFFLINE_ACCESS, Permission.PUBLISH_STREAM});</i><br />
<i>...</i><br />
<br />
This code snippet says the app will request permission to perform authorized requests on behalf of the user at any time (<b>OFFLINE_ACCESS</b>) and publish content to a user's feed at any time <b>PUBLISH_STREAM</b>. For the full list of permissions provided by Facebook API, click <a href="http://developers.facebook.com/docs/authentication/permissions/" target="_blank">here</a>.<br />
<br />
<b>Authentication Events</b><br />
<br />
In order to know if the user granted or denied permission to the app, you need to register a listener of the type <i><b>AuthenticationListener</b></i>. This interface has three methods:<br />
<br />
- <b>onAuthorize</b>(String token)<br />
- <b>onAccessDenied</b>(String message)<br />
- <b>onFail</b>(String error, String message)<br />
<br />
<b><i>onAuthorize</i></b><i>()</i> means the user has granted permission to the app along with the <b>Access Token</b>. Keep this token, since you will use it to sign all your requests to Facebook API. This token works to identify your app. So, from this point on, you can dismiss the login page and start publishing links, comments, etc.<br />
<br />
<b><i>onAccessDenied</i></b><i>()</i> means the user has denied access to his Facebook account. It does not mean the user can change his mind later and then authorize your app.<br />
<br />
<b><i>onFail</i></b><i>()</i> means that something went wrong during the authentication process. Just try again!<br />
<br />
<i>...</i><br />
<i>pageWrapper.addAuthenticationListener(this);</i><br />
<i>...</i><br />
<i><br />
</i><br />
<i>public void onAuthorize(String token) {</i><br />
<i> System.out.println("onAuthorize: " + token);</i><br />
<i>}</i><br />
<i><br />
</i><br />
<i>public void onAccessDenied(String message) {</i><br />
<i> System.out.println("access_denied: " + message);</i><br />
<i>}</i><br />
<i><br />
</i><br />
<i>public void onFail(String error, String message) {</i><br />
<i> System.out.println("error: " + error + " message: " + message);</i><br />
<i>}</i><br />
<i>...</i><br />
<br />
<b>Displaying Login Page</b><br />
<br />
The Facebook's Login page will just be requested and displayed, as soon as the method <i><b>login</b>()</i> be called.<br />
<br />
<i>...</i><br />
<i>pageWrapper.login();</i><br />
<i>...</i><br />
<br />
<b>Dispatching Requests</b><br />
<br />
The API also provides a helper class, called <i><b>Dispatcher</b></i>, responsible for dispatching the requests, synchronously or asynchronously, to Facebook API. Each <i>Dispatcher</i> instance must be associated to an access token, so all requests dispatched be signed automatically.<br />
<br />
<i>...</i><br />
<i>Dispatcher dispatcher = Dispatcher.getInstance("Access Token goes here");</i><br />
<i>...</i><br />
<br />
<b>Dispatcher Events</b><br />
<br />
When you work with asynchronous requests, it is recommended to register a listener in order to know whether they were successfully processed. This listener is defined by <i><b>DispatcherListener</b></i> interface. This interface has two methods:<br />
<br />
- <b>onComplete</b>(Request request, Response response)<br />
- <b>onFail</b>(Request request, Throwable error)<br />
<br />
<b><i>onComplete</i></b><i>()</i> means the request was processed successfully and returns the result (response).<br />
<br />
<b><i>onFail</i></b><i>() </i>means the request failed, returning the cause.<br />
<br />
<i>...</i><br />
<i>dispatcher.addDispatcherListener(this);</i><br />
<i>...</i><br />
<i><br />
</i><br />
<i>public void onComplete(Request request, Response response) {</i><br />
<i> ...</i><br />
<i>}</i><br />
<i><br />
</i><br />
<i>public void onFail(Request request, Throwable error) {</i><br />
<i> ...</i><br />
<i>}</i><br />
<i>...</i><br />
<br />
<b>Posting on User's Wall</b><br />
<br />
To publish a text on user's wall is pretty simple. Just instantiate an object of <b><i>Status</i></b> class, informing the text in the constructor. The other constructor allows you to post a text on a friend's wall.<br />
<br />
<i>...</i><br />
<i>Status status = new Status("Text goes here");</i><br />
<i>dispatcher.dispatch(status); //synchronously</i><br />
<i><br />
</i><br />
<i>//or dispatcher.addToQueue(status); //asynchronously</i><br />
<i>...</i><br />
<i><br />
</i><br />
<i>Status status = new Status("Text goes here", "Friend's Id goes here");</i><br />
<i>dispatcher.dispatch(status);</i><br />
<i>...</i><br />
<br />
<b>Sharing Link</b><br />
<b><br />
</b><br />
To share a link is as easy as posting on wall. Just instantiate an object of <i><b>Link</b></i> class, informing the URL in the constructor. The other constructor allows you to define how the link will be displayed.<br />
<br />
<i>...</i><br />
<i>Link link = new Link("Link's URL goes here");</i><br />
<i>dispatcher.dispatch(link);</i><br />
<i>...</i><br />
<i>Link link = new Link("Link'URL goes here", "Link's Picture Uri goes here", "Link's Name goes here", "Link's Caption goes here", "Link's Description goes here", "Link's Message goes here", "Friend's Id goes here");</i><br />
<i>dispatcher.dispatch(link);</i><br />
<i>...</i><br />
<br />
<b>Retrieving Friends List</b><br />
<br />
To retrieve the user's friends list just instantiate an object of <b><i>Friends</i></b> class. This request returns an instance of <i><b>Friends.Response</b></i>, which is <b><i>Enumeration</i></b>.<br />
<br />
<i>...</i><br />
<i>Friends friends = new Friends();</i><br />
<i>Friends.Response friendsEnum = (Friends.Response) dispatcher.dispatch(friends);</i><br />
<i><br />
</i><br />
<i>while (friendsEnum.hasMoreElements()) {</i><br />
<i> Friends.Response friend = (Friends.Response)friendsEnum.nextElement();</i><br />
<i> String friendId = friend.getId();</i><br />
<i> String friendName = friend.getName();</i><br />
<i> ...</i><br />
<i>}</i><br />
<i>...</i><br />
<br />
<b>Profile Picture</b><br />
<br />
To retrieve a friend's profile picture, create an instance of <b><i>Picture</i></b> class, informing the friend's Id in the constructor. This request returns an instance of <b><i>Picture.Response</i></b>.<br />
<br />
<i>...</i><br />
<i>Picture picture = new Picture("Friend's Id goes here");</i><br />
<i>Picture.Response pictureResp = (Picture.Response)dispatcher.dispatch(picture);</i><br />
<i>byte[] imageBytes = pictureResp.getData();</i><br />
<i>...</i><br />
<br />
<b>Revoking Authorization</b><br />
<br />
Just in case an user decides to remove your app's authorization to access his Facebook account. For that, use the request defined by <i><b>RevokeAuthorization</b></i> class, informing the access token in the constructor. Once this request is processed, the access token is expired and you app will no longer be able to access the user's account. To access it again, the entire authentication process must be redone.<br />
<br />
<i>...</i><br />
<i>RevokeAuthorization revoke = new RevokeAuthorization("Access Token goes here");</i><br />
<i>dispatcher.dispatch(revoke);</i><br />
<i>...</i><br />
<br />
<b>Log out</b><br />
<br />
The wrapper class <b><i>AuthDialogWrapper</i></b> has a method called <b><i>logout</i></b><i>()</i>. Call this method in order to remove any cookie or logged user's data left by Facebook's Login page in our browser component. It is recommend to call this method when the user removes the app's authorization.<br />
<br />
It is important to point out that all items presented here are valid for all versions of Facebook API ME. It does matter if you are working on Blackberry, LWUIT or Android. The steps are all the same, except at item 3, regarding the type of subclass. Each platform has its own subclass of <i>AuthDialogWrapper</i>.<br />
<br />
So, I hope this tutorial has been useful for you guys, as well as the API itself.<br />
<br />
As soon as the release of the other platforms are released, I will let everybody knwos.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com26tag:blogger.com,1999:blog-5658388309594372146.post-4059671947675372822011-05-23T09:42:00.000-03:002011-05-23T09:42:58.575-03:00Facebook API ME & HTMLComponent: Not going well.Hi, all<br />
<br />
Yesterday, I took the day to work on my new project: <b>Facebook API ME</b>. The development is going well, btw. As I explained in the previous posts, the great challenge of this project is the authentication process, since it requires certain browser integration, which is not a trivial thing considering Java ME.<br />
<br />
Anyway, the API is now working properly using <i>Browser</i> component from <b>eSWT</b> library. eSWT is available in most Nokia and Sony Ericsson devices. I intend to release it for developers this week. I will let you guys know.<br />
<br />
Regarding <b>LWUIT</b> integration, using <i>HTMLComponent</i>, the work is not going so well. HTMLComponent is not working well with Facebook's authentication pages. Actually, it works well on login page, where the username/password are informed. On the other hand, the page where the user authorizes the app to access his account is not displayed properly. HTMLComponent is not able to display the "Accept" and "Deny" submit buttons. Because of that, the authentication process is not complete.<br />
<br />
I tried to check out LWUIT's latest source code from SVN repository, but it seems they are refactoring the code for some reason. There is an error in one of the classes. Because of that, I was not able to generate a jar file. Is there anybody here that could help with that?<br />
<br />
I also intend to work on <b>Blackberry</b> integration, using <i>BrowserField</i> component. But as I am not a Blackberry expert, I have to study a little bit to understand how it works so I can work with it.<br />
<br />
I let you guys posted.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com4tag:blogger.com,1999:blog-5658388309594372146.post-76537188798899218522011-04-14T13:41:00.000-03:002011-04-14T13:41:42.481-03:00Facebook API for Java ME: In the worksHi, all<br />
<br />
Let's make it different this time. I use to announce my new projects just when they are ready to go, but let's change the paradigm.<br />
<br />
Early this week, I checked in to Kenai, the alpha source code of my <a href="http://kenai.com/projects/facebookapime" target="_blank"><b>Facebook API ME</b></a> project. The name stands for itself, it is API that allows Java ME apps to access <a href="http://www.facebook.com/" target="_blank">Facebook</a>. In fact, I had already commented on this project in the last <a href="http://j2megroup.blogspot.com/2011/03/facebook-and-java-me-how-to.html" target="_blank">post</a>.<br />
<br />
The code is in alpha version, but most features are already done and tested. I am stating it is still as alpha, since I need to retest the authentication feature using <a href="http://www.amazon.com/SWT-Developers-Notebook-Tim-Hatton/dp/0596008384?ie=UTF8&tag=j2grbl-20&link_code=btl&camp=213689&creative=392969" target="_blank">eSWT</a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=j2grbl-20&l=btl&camp=213689&creative=392969&o=1&a=0596008384" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" />, besides implementing support to <a href="http://www.amazon.com/LWUIT-1-1-Java-ME-Developers/dp/184719740X?ie=UTF8&tag=j2grbl-20&link_code=btl&camp=213689&creative=392969" target="_blank">LWUIT</a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=j2grbl-20&l=btl&camp=213689&creative=392969&o=1&a=184719740X" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" />, by using HTMLComponent.<br />
<br />
Currently, besides authentication, Facebook API ME also supports the following features:<br />
<ul><li>Post status</li>
<li> Share link</li>
<li>Get list of friends</li>
<li>Get friend's profile picture</li>
</ul>It is not many features, but the way this API is designed, it is a snap to get new ones available.<br />
<br />
As soon as I have time, I will complete the tests, so I can officially release the API's version 1.0. The source code is already available for <a href="http://kenai.com/projects/facebookapime/sources" target="_blank">check out</a>, just in case you are very curious.<br />
<br />
I hope you guys also enjoy this new project.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com3tag:blogger.com,1999:blog-5658388309594372146.post-8662761491796903232011-03-16T09:59:00.000-03:002011-03-16T09:59:56.783-03:00Facebook and Java ME: How to authenticate?Hi all,<br />
<br />
Last month, I have developed a tiny API that integrates a Java ME app into Facebook. The implementation was not a big deal, except the authentication process. Since Facebook uses <a href="http://oauth.net/2/" target="_blank">OAuth 2.0</a>, it requires that any app that wants to integrate into Facebook's services must authenticate via its web login page. We all know that displaying HTML page in Java ME is not a easy task, since we have no LCDUI component that renders HTML. Fortunately, <span id="goog_1693722695"></span><a href="http://lwuit.java.net/" target="_blank">LWUIT<span id="goog_1693722696"></span></a> already provides that via <a href="http://www.nextgenmoco.com/2010/02/mobile-web-and-html-inside-javame-with.html" target="_blank">HTMLComponent</a>.<br />
<br />
But how to accomplish that if my app is not based on LWUIT? Hard question, huh? In my case, fortunately, the app that I had to integrate into Facebook is based on <a href="http://www.eclipse.org/ercp/" target="_blank">eSWT</a>, which provides a Browser component. Because that, I was able to access the Facebook's login page and track the whole process in order to retrieve the token access required to access the methods from Facebook API.<br />
<br />
My point in this post is: how to integrate Java ME app into Facebook API without a browser component? What is the trick? Parser the web login page's content and simulate the form submission programmatically? How have you guys have done that?<br />
<br />
In intend to release my Facebook API in a near future. So I would like to know a better approach to implement the authentication process, so this API do not get tied to any specific framework.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com11tag:blogger.com,1999:blog-5658388309594372146.post-72788679344019996382011-03-11T14:42:00.000-03:002011-03-11T14:42:29.897-03:00Google Analytics ME 1.2: Android SupportHi all,<br />
<br />
Today I have released a new version of <b><a href="http://kenai.com/projects/googleanalyticsme" target="_blank">Google Analytics ME</a></b> project. This is also a small release that just consists of bug fixes and a new support for <a href="http://www.amazon.com/Samsung-Smartphone-Bluetooth-Screen-International-Warranty/dp/B0049PM9HO?ie=UTF8&tag=j2grbl-20&link_code=btl&camp=213689&creative=392969" target="_blank">Android</a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=j2grbl-20&l=btl&camp=213689&creative=392969&o=1&a=B0049PM9HO" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" /> 1.5 or newer.<br />
<br />
You can download it by clicking <a href="http://kenai.com/projects/googleanalyticsme/downloads">here</a>.<br />
<br />
See you in the next post...Ernandes Mourão Júniorhttp://www.blogger.com/profile/05269717786146137246noreply@blogger.com0