Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2012

    [ASK] My Position with JSR-179 in Nokia Map

    hi, i'm arif..

    I make application use nokia map
    I display my current position with jsr 179.
    but When I move, the marker (my position marker) is not move..

    this my code:
    mnUtm midlet;
        Display display;
        MapCanvas mapCanvas;
        MapDisplay mapDisplay;
        MapFactory mapFactory;
        Command cmKembali, cmMenu, cmInfo ;
        LocationProvider lp;
        WaypointParameterList wpl;
        MapStandardMarker pos;
        skalaMap skala;
        legendaMap kompas;
        String string;
        Alert info;
    public mnPosisiku (mnUtm midlet, Display display) {
            this.midlet = midlet;
            this.display = display;
            wpl = new WaypointParameterList();
            skala = new skalaMap();
            kompas = new legendaMap();
        public void pos() {
          try {
          //Make MapCanvas
            mapCanvas = new MapCanvas(display);
            mapDisplay = mapCanvas.getMapDisplay();
          //Make Command
            cmKembali = new Command("Kembali", Command.BACK, 0);
            cmInfo = new Command("Info", Command.OK, 1);
         //Current position with JSR-179
            Criteria cr = new Criteria();
            lp = LocationProvider.getInstance(cr);
            Location l = lp.getLocation(60);
            Coordinates c = l.getQualifiedCoordinates();
                if (c != null) {
                        double lat = c.getLatitude();
                        double lon = c.getLongitude();
            mapCanvas.getMapDisplay().setCenter(new GeoCoordinate(lat, lon, 0));
         //Make marker (my current position) in Map
           Point center = new Point(mapCanvas.getWidth()/2, mapCanvas.getHeight()/2);
           GeoCoordinate gc = mapDisplay.pixelToGeo(center);
           pos = mapCanvas.getMapFactory().createStandardMarker(gc, 10, null, MapShapeType.bed);
           mapCanvas.setTitle("Posisi Saat Ini");
           string = "Posisi Anda Saat ini Berada di :" +
                            "\nLatitude : " + lat + "\nLongitude : " + lon;
         //Display Map
        } catch (Exception ex) {
        public void commandAction(Command c, Displayable d) {
          //Back to Main Menu
            if (c == cmKembali) {
               //Display Coordinates my position
                if (c == cmInfo) {
                    info = new Alert("Detail Posisi", string, null, AlertType.INFO);
                    display.setCurrent(info, mapCanvas);
    How to move my position marker when I move? (Real-time position)

    please help me
    thank you
    Last edited by Arif_Mubashir; 2012-06-04 at 14:28.

  2. #2
    Nokia Developer Expert
    Join Date
    May 2012

    Re: [ASK] My Position with JSR-179 in Nokia Map

    if you want marker always to be at the center then you need to update the marker while listening to maps move events.
    something like this
    Point center = new Point(map.getWidth() / 2, map.getHeight() / 2);
    GeoCoordinate gc = map.pixelToGeo(center);
    Marker marker =/..marker instance*/

  3. #3
    Nokia Developer Expert
    Join Date
    Aug 2011

    Re: [ASK] My Position with JSR-179 in Nokia Map

    When I move, the marker (my position marker) is not move..
    Do you get a new set of coordinates? You don't seem to update your location. You seem to only retrieve it once. Apart from the Nokia Maps API that helps you display the map and the marker on your current location, you would need to get updates on your location in frequent intervals. I would suggest that you attach a location listener to your location provider and retrieve the location updates via the locationUpdated method. You can find more information about listening to location updates here

Similar Threads

  1. How can i move/drag to a position,a nokia.maps.map.StandardMarker with a button event
    By upixsoul in forum [Archived] Maps API for Javascript
    Replies: 2
    Last Post: 2012-06-04, 17:20
  2. Nokia N95 network gps position finding problem in J2ME?
    By DileepKumar in forum Mobile Java General
    Replies: 1
    Last Post: 2012-01-02, 16:08
  3. Replies: 0
    Last Post: 2011-09-14, 11:03
  4. J2ME Location API vs. Nokia Series 40 Position API
    By keyang_huang in forum Mobile Java General
    Replies: 1
    Last Post: 2005-04-27, 08:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts