View RSS Feed

My Java Tips

  1. GPS location / Cell id / Placing a call

    by , 11-22-2011 at 06:16 PM (My Java Tips)
    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();
    ...