×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    6

    How to display Nokia Maps.

    Hi, I am just learning J2ME. Can any one tell me why the code below fails to display a map but insteady displays a blank screen:



    /* HelloMapMidlet */
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */
    package simo.map;

    import com.nokia.maps.common.ApplicationContext;
    import javax.microedition.lcdui.Display;
    import javax.microedition.midlet.MIDlet;

    /**
    * @author simon
    */
    public class HelloMapMIDlet extends MIDlet{


    public HelloMapMIDlet()
    {

    }

    public void startApp() {
    // Get your own app_id and token by registering at
    // https://api.developer.nokia.com/ovi-api/ui/registration
    ApplicationContext.getInstance().setAppID(" ");
    ApplicationContext.getInstance().setToken(" ");


    Display display = Display.getDisplay(this);
    MyMapCanvas hellomap = new MyMapCanvas(display, this);

    display.setCurrent(hellomap);

    }


    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
    }





    /* MyMapCanvas*/
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    /**
    *
    * @author simon
    */
    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */
    package simo.map;

    import com.nokia.maps.common.GeoCoordinate;
    import com.nokia.maps.map.MapCanvas;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.MIDlet;
    /**
    * @author simon
    */
    public class MyMapCanvas extends MapCanvas implements CommandListener{

    private final Command EXIT = new Command("Exit", Command.EXIT, 1);
    protected MIDlet midlet; // for notifyDestroyed

    public MyMapCanvas(Display display, MIDlet midlet) {
    super(display);

    this.midlet = midlet;
    addCommand(EXIT);
    setCommandListener(this);

    getMapDisplay().setZoomLevel(10, 0, 0);
    getMapDisplay().setCenter(new GeoCoordinate(52.5, 13.4, 0));
    }

    /*
    public void paint1(Graphics g){
    paint(g);
    }
    */
    public void commandAction(final Command c, Displayable d) {
    if (c == EXIT) {
    midlet.notifyDestroyed();
    } else {
    commandRun(c);
    }
    }

    protected void commandRun(Command c) {

    // handle any other command
    }

    public void onMapUpdateError(String string, Throwable thrwbl, boolean bln) {
    // add code for update error handling
    }

    public void onMapContentComplete() {
    // add code for content updated handling
    }

    }

  2. #2
    Registered User
    Join Date
    Sep 2012
    Location
    Timisoara, Romania
    Posts
    19

    Re: How to display Nokia Maps.

    Because of that:
    Get your own app_id and token by registering at
    // https://api.developer.nokia.com/ovi-api/ui/registration
    You need to register for accesing Nokia Maps API and you need to provide AppID and Token in code

  3. #3
    Registered User
    Join Date
    Jan 2013
    Posts
    6

    Re: How to display Nokia Maps.

    Even when I include the AppID and Token, the map is not display but only displays the word "NOKIA" at the bottom.

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: How to display Nokia Maps.

    Try to reduce the Zoom level and try to display different co-ordinates.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  5. #5
    Registered User
    Join Date
    Jan 2013
    Posts
    6

    Re: How to display Nokia Maps.

    I tried changing co-ordinates and zoom level but there was no change. it only displays the word "0.20KB" at the top right corner, zoom symbols: "+" and "-" in the middle and the word "Nokia" on the bottom-left corner. The map lines are not displayed.

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: How to display Nokia Maps.

    Also, please download the latest 1.1 Maps, you appear to be using some older version (the intialization is actually different)

    Get the latest from: http://www.developer.nokia.com/Devel...I_for_Java_ME/

    Note that the code in: https://www.developer.nokia.com/Deve...tting_started/ is incorrect, instead use code from: https://www.developer.nokia.com/Deve...Code_examples/

    More examples can be found from: http://www.developer.nokia.com/Commu...PI_for_Java_ME

  7. #7
    Registered User
    Join Date
    Jan 2013
    Posts
    6

    Re: How to display Nokia Maps.

    Thank you for the assistance but I seem to get the same results even with the newly downloaded Nokia Maps Api. I even tried to run examples that come with Nokia Maps Api but I got the same results.

  8. #8
    Registered User
    Join Date
    Feb 2004
    Posts
    1,980

    Re: How to display Nokia Maps.

    Be sure your simulator can access internet properly.

  9. #9
    Registered User
    Join Date
    Jan 2013
    Posts
    6

    Re: How to display Nokia Maps.

    I thought I only need to use an emulator for testing Maps Apps. I request you to throw more light on the need for a simulator that is connected to internet?

  10. #10
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: How to display Nokia Maps.

    Basically people mix emulator & simulator here all the time.

    What he means that, you should check that you do have internet connectivity with the emulator you are using, or if you use a real device, see that it has internet connectivity.

  11. #11
    Registered User
    Join Date
    Jan 2013
    Posts
    6

    Re: How to display Nokia Maps.

    Thanks guys, it has worked. the problem was with my internet connection.

  12. #12
    Registered User
    Join Date
    Feb 2004
    Posts
    1,980

    Re: How to display Nokia Maps.

    Quote Originally Posted by symbianyucca View Post
    Basically people mix emulator & simulator here all the time.
    Please tell us the difference.

    Thanks!

  13. #13
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: How to display Nokia Maps.

    Quote Originally Posted by r60600 View Post
    Please tell us the difference.

    Thanks!
    Difference is that if you do not have internet connection, you wont be seeing any map. and once you get the internet working in your development environment, the maps data will be downloaded and thus you will be able to see the map.

Similar Threads

  1. Alternatives for nokia.maps.map.Object.destroy() for removing Polygon from Display?
    By tommituura in forum [Archived] Maps API for Javascript
    Replies: 1
    Last Post: 2012-12-21, 12:33
  2. how can i, create a nokia.maps.map.Polyline using a nokia.maps.routing.Manager?
    By upixsoul in forum [Archived] Maps API for Javascript
    Replies: 5
    Last Post: 2012-05-30, 15:54
  3. Replies: 3
    Last Post: 2012-04-20, 09:25
  4. Is there a way to convert Maps Data from Nokia Maps 3 to be compatible with N Maps 2
    By dimchopicha in forum General Development Questions
    Replies: 6
    Last Post: 2011-01-09, 17:50
  5. Navigation route coordinates from Nokia Maps or Ovi Maps
    By selimsolmaz in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2010-03-04, 10:02

Posting Permissions

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