×

Discussion Board

Results 1 to 3 of 3

Threaded View

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    18

    [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:
    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);
            mapCanvas.addCommand(cmKembali);
            mapCanvas.addCommand(cmInfo);
            mapCanvas.setCommandListener(this);
            
         //Current position with JSR-179
            Criteria cr = new Criteria();
            cr.setHorizontalAccuracy(500);
    
            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));
            mapCanvas.getMapDisplay().setZoomLevel(16,0,0);
    
         //Make marker (my current position) in Map
           Point center = new Point(mapCanvas.getWidth()/2, mapCanvas.getHeight()/2);
           GeoCoordinate gc = mapDisplay.pixelToGeo(center);
           wpl.addCoordinate(gc);
           pos = mapCanvas.getMapFactory().createStandardMarker(gc, 10, null, MapShapeType.bed);
           mapDisplay.addMapObject(pos);
           mapDisplay.addMapComponent(skala);
           mapDisplay.addMapComponent(kompas);
           mapCanvas.setTitle("Posisi Saat Ini");
    
           string = "Posisi Anda Saat ini Berada di :" +
                            "\nLatitude : " + lat + "\nLongitude : " + lon;
    
         //Display Map
            display.setCurrent(mapCanvas);
        
                }
    
        } catch (Exception ex) {
            ex.printStackTrace();
            }
        }
    
        public void commandAction(Command c, Displayable d) {
          //Back to Main Menu
            if (c == cmKembali) {
               display.setCurrent(midlet.menu);
               }
               //Display Coordinates my position
                if (c == cmInfo) {
                    info = new Alert("Detail Posisi", string, null, AlertType.INFO);
                    info.setTimeout(60000);
                    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.

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
  •  
×