Posts Tagged ‘mobile’
Primosync: Synchronize Google Calendar with Mobile Phone

This week, I’ve tried Primosync, a JavaME application which allows you to synchronize your Calendar, Events and activities with Google Calendar.
Primosync is compatible with mobile phone which supports JavaME JSR-75 PIM API, a feature that becoming common in latest modern phones.
Advantages of syncing phone calendar with Google Calendar :
- You will be able to access your event, activities and reminders anywhere with internet connection
- Your events and reminder will be more portable across various phone models as you can sync it with Google Calendar to update your Calendar
- Easier to keep track of your reminder and events
- As a backup measure in case if your mobile phone is stolen or lost
You can download it from Primosync Google Code project website (yes it is open source!) or from Primosync.mobi download site (mobile phone friendly). Available in 3 versions (Blackberry, JavaME Signed, JavaME Unsigned), for some reasons, I was unable to install the Signed version of Primosync in my E71. So I figure the Unsigned version might work in more phones.
So lets start syncing!
Tags: calendar, j2me, Java, javame, jsr-75, mobile, mobile phone, PDA, sync, synchronization, synchronize
How to get Nokia Battery Level in JavaME
Nokia Symbian 3rd Edition phone introduces “com.nokia.mid.batterylevel” properties which you can get the current battery charge level by calling System.getProperty(“com.nokia.mid.batterylevel”) from within your midlet application. Its up to your imagination for you to do the rest.
Sample source code (displaying battery charge level on gauge):
/********** /* /* Nokia Battery Level midlet /* Copyright 2008 Mohammad Hafiz bin Ismail ([email protected]) /* http://mobilepit.com /* /* May be use freely **********/ import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class NokiaBattery extends MIDlet implements CommandListener { int value; Display display; Form form; Gauge gauge; Command cmdExit; public NokiaBattery() { display = Display.getDisplay(this); form = new Form("Nokia Battery"); cmdExit = new Command("Exit",Command.EXIT,1); form.addCommand(cmdExit); value=Integer.parseInt(System.getProperty("com.nokia.mid.batterylevel")); gauge = new Gauge("Level",false,100,value); form.append(gauge); form.append("Value :"+value); StringItem item = new StringItem("Network Signal",System.getProperty("com.nokia.mid.networksignal")); form.append(item); form.setCommandListener(this); } public void startApp(){ display.setCurrent(form); } public void pauseApp() {} public void destroyApp(boolean flags) { notifyDestroyed(); } public void commandAction (Command cmd, Displayable disp) { if (cmd == cmdExit) { destroyApp(false); } } }
Download source code and sample midlet : NokiaBattery_midlet.zip
Free Skype JavaME (J2ME) client for mobile device
Great news for those who are using Skype to get connected with their contacts, now they can do so while on the move with the free Skype mobile client.
The mobile client offers chat feature as well as receiving calls from Skype contacts. However airtime charge may incur for receiving voice call, depending on the subscribers’ data plan.

The main advantage of this J2ME client is portability across a wide-range of mobile devices which implements MIDP 2.0. Although the Skype Mobile website lists only handful of supported device, in reality Mobile Skype is supported on a lot more devices.
Disadvantages include its inability to send SMS to your contacts and the inability to make voice calls. However in my opinion, the free Mobile Skype does its best considering it is written for mobile devices with limited capabilities.
You can download Skype Mobile from this website : http://mobiledownload.skype.com/
Tips
With little creativity on java jad file, you can install Mobile Skype on any MIDP 2.0 supported device without much trouble
Cool J2ME Game Demo – Opposite Lock
Here’s a video clip from the Grand Prize winner of Java Mobile Application Video Contest organized by Sun.
The demo feature a Mobile Java (j2me) car racing game called Opposite Lock. Enjoy the video.
[coolplayer width="425" height="360" autoplay="0" loop="0" charset="utf-8" download="1" mediatype=""]
J2ME Opposite Lock Game
[/coolplayer]
You can download and buy Opposite Lock from clickgamer.com
Download J2ME WheelItem CustomItem
This is an example of J2ME / JavaME CustomItem called WheelItem. It does nothing beside showing a spinning wheel on the phone screen. WheelItem is a perfect candidate to be displayed on a wait form screen replacing Gauge class while your application is performing lengthy operating.
WheelItem Screenshot
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;
public class WheelItem extends CustomItem
{
private int mCount,mMaximum;
private int mInterval;
private int mWidth,mHeight,mX,mY,mRadius;
private String mMessage;
public WheelItem(String title)
{
super(title);
mCount=0;
mMaximum = 36;
mInterval = 100;
TimerTask task = new TimerTask() {
public void run() {
mCount = (mCount+1) % mMaximum;
repaint();
}
};
Timer timer = new Timer();
timer.schedule(task,0,mInterval);
}
public void setString(String string)
{
mMessage = string;
repaint();
}
public void paint(Graphics g, int iWidth, int iHeight) {
mWidth = iWidth;
mHeight = iHeight;
int halfWidth = mWidth/2;
int halfHeight = mHeight/2;
mRadius = Math.min(halfWidth,halfHeight);
mX = halfWidth - mRadius/2;
mY = halfHeight - mRadius/2;
int theta = -(mCount*360/mMaximum);
g.setColor(255,255,255);
g.fillRect(0,0,mWidth,mHeight);
g.setColor(0,0,0);
g.drawArc(mX,mY,mRadius,mRadius,0,360);
g.fillArc(mX,mY,mRadius,mRadius,theta+90,90);
g.fillArc(mX,mY,mRadius,mRadius,theta+270,90);
if (mMessage !=null)
{
g.drawString(mMessage,mWidth/2,mHeight,Graphics.BOTTOM | Graphics.HCENTER);
}
}
public int getMinContentWidth() { return 80; }
public int getMinContentHeight() { return 80; }
public int getPrefContentWidth(int width) {return getMinContentWidth();}
public int getPrefContentHeight(int height) {return getMinContentHeight();}
}
Download example application with WheelItem source : WaitFormDemo.zip
Ported (rather poorly) from Wheel canvas written by Jonathan Knudsen from his article – Networking, User Experiences and Threads.
Any suggestions or improvements are welcomed!
SymbianTutorial.org – Symbian application development basic
SymbianTutorial.org is a good website to learn about fundamental application development in Symbian (especially series60).
Though some information about the IDE is slightly outdated (as stated on the website), the tutorial website covers basic Symbian data type, class naming convention, exception handling, input/output, gui handling basics and how to create resource file for Symbian development platform.
The website itself is structred in a way to introduce reader to Symbian application development environment, which is the main platform used in Nokia and Sony-Ericsson smartphones.
iPhoneCanvas – Fancy List component class for J2ME
I found a really nice but simple to use fancy list chooser class that emulates an iPhone display. The class requires MIDP 2.0 supported phones and can replace the default and boring List chooser class into a stunning, smooth scrolling graphical menu (includes reflections) for your users to see
Here’s example screenshot of iPhoneCanvas demo in action :
These menu icons are generated from flat and boring thumbnails like these :


Download
iPhoneCanvas is licensed under the GNU General Public License and can be downloaded from listchooser Google Code project page
Demo
The iPhoneCanvas demo featured in above screenshot can be downloaded here – fancylist.jar, fancylist.zip (demo source code)
Please submit bug reports or suggestions at Google Code listchooser page
How to generate Random Numbers in J2ME application
One of the popular question asked in this blog is ways to generate random numbers in J2ME application.
As most people probably realized, the JavaME CLDC does not include the Math.Random class to generate random numbers. However one can generate a series of random numbers in JavaME/J2ME application by using the included java.util.Random class.
Here’s a sample usage
import java.util.Random;
...
Random generator = new Random();
generator.setSeed(System.currentTimeMillis());
float f = generator.nextFloat();
System.out.println(""+(f*100.0f)%100);
...
The sample code above will produce a random floating-point number between 0..100 (exclusive)
Here’s the source code for the full Random Number Demo application : RandomDemo.java,
Foxrate – Open Source J2ME Currency Converter Mobile Application
Foxrate mobile is a currency converter application for mobile devices. It is a relatively small application which supports converting from/to 35 different currencies used around the world.
Foxrate lifts you from the burden of updating currency rate by automatically retrieving latest currency information from remote server. The best part about foxrate is — it is available for free and open source!
Download Foxrate Mobile Currency Converter
Foxrate can downloaded from- Google Code’s Foxrate page and Getjar.com

