View RSS Feed

My Java Tips

GPS location / Cell id / Placing a call

Rating: 1 votes, 1.00 average.
by , 11-22-2011 at 06:16 PM (1698 Views)
This post presents miscellaneous tasks that you can do in your J2ME application.


Firstly, how to get GPS location. javax.microedition.location.Location provides support for this. Review the snippet below:

Java Code:
LocationProvider loc = LocationProvider.getInstance(null);
loc.setLocationListener(ll,0,-1,-1);
Location location = loc.getLocation(60*3);
String lat = location.getQualifiedCoordinates().getLatitude();
String lon = location.getQualifiedCoordinates().getLongitude();
Getting cell id is very easy:
Java Code:
String cellID = System.getProperty("phone.cid");
For placing a call, you need com.motorola.phone.

Java Code:
Dialer dialer = Dialer.getDefaultDialer();
dialer.startCall("6172531000");

Submit "GPS location / Cell id / Placing a call" to Facebook Submit "GPS location / Cell id / Placing a call" to Digg Submit "GPS location / Cell id / Placing a call" to del.icio.us Submit "GPS location / Cell id / Placing a call" to StumbleUpon Submit "GPS location / Cell id / Placing a call" to Google

Comments