Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User ninetailedrat's Avatar
    Join Date
    Nov 2007
    Posts
    1
    Hi all i have written this piece of code below. It works fine when in the java wireless tool kit emulator. However when i put the program on my nokia 6300 it comes up with the error "No Class Def Found Error java/lang/NoClassDef FoundError javax/microedition/location/Coordinates

    Code:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.location.*;
     public class test extends MIDlet implements CommandListener{
        
        private Display display;
        private TextBox textbox;
        private Command quitCommand;
        private double lon;
        private double lat;
        private Location l;
        
        public void startApp()
        {
            try
            {
                // Set criteria for selecting a location provider:
                // accurate to 500 meters horizontally
                Criteria cr= new Criteria();
                cr.setHorizontalAccuracy(500);
    
                // Get an instance of the provider
                LocationProvider lp= LocationProvider.getInstance(cr);
    
                // Request the location, setting a one-minute timeout
                l = lp.getLocation(60);
                Coordinates c = l.getQualifiedCoordinates();
    
                if(c != null ) {
                    // Use coordinate information
                    lat = c.getLatitude();
                    lon = c.getLongitude();
                }
            }
            catch(Exception e)
            {
    		lon = 0.0;
    		lat = 0.0;
    		
            }
            display = Display.getDisplay(this);
            quitCommand = new Command ("Quit",Command.SCREEN,1);
            textbox =new TextBox ("Location Test", l,40,0);
            textbox .addCommand (quitCommand);
            textbox .setCommandListener(this);
            display .setCurrent(textbox);
            
        }
        
        public void pauseApp()
        {
            
        }
         
        public void destroyApp(boolean unconditional)
        {
            
        }
        
        public void commandAction (Command choice, Displayable displayable)
        {
            if (choice == quitCommand)
            {
                destroyApp(false);
                notifyDestroyed();
            }
        }
    }
    Can any one help at all

  2. #2
    Nokia Developer Champion hartti's Avatar
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,192
    6300 does not support Location API. You need to use bluetooth API, connect to the GPS receiver and retrieve/parse the NMEA sentences yourself.

    Hartti

  3. #3
    Registered User Dom1984's Avatar
    Join Date
    Nov 2007
    Posts
    1
    If got a similiar problem while using the location API. I think the 6300 does not support that API. If you got a solution on that, please keep me up to date!

    SORRY! I did no recognize that someone else already answered!

    Is there any solution known, how to use the API on a 6300 instead of using bluetooth and GPS receiver???
    Last edited by Dom1984; 2007-11-03 at 09:58.

  4. #4
    Nokia Developer Champion hartti's Avatar
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,192
    There is no other solution than what I offered above.

    Hartti

  5. #5
    Registered User alluoshi's Avatar
    Join Date
    Nov 2007
    Posts
    7
    Quote Originally Posted by ninetailedrat View Post
    Hi all i have written this piece of code below. It works fine when in the java wireless tool kit emulator. However when i put the program on my nokia 6300 it comes up with the error "No Class Def Found Error java/lang/NoClassDef FoundError javax/microedition/location/Coordinates

    Code:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.location.*;
     public class test extends MIDlet implements CommandListener{
        
        private Display display;
        private TextBox textbox;
        private Command quitCommand;
        private double lon;
        private double lat;
        private Location l;
        
        public void startApp()
        {
            try
            {
                // Set criteria for selecting a location provider:
                // accurate to 500 meters horizontally
                Criteria cr= new Criteria();
                cr.setHorizontalAccuracy(500);
    
                // Get an instance of the provider
                LocationProvider lp= LocationProvider.getInstance(cr);
    
                // Request the location, setting a one-minute timeout
                l = lp.getLocation(60);
                Coordinates c = l.getQualifiedCoordinates();
    
                if(c != null ) {
                    // Use coordinate information
                    lat = c.getLatitude();
                    lon = c.getLongitude();
                }
            }
            catch(Exception e)
            {
    		lon = 0.0;
    		lat = 0.0;
    		
            }
            display = Display.getDisplay(this);
            quitCommand = new Command ("Quit",Command.SCREEN,1);
            textbox =new TextBox ("Location Test", l,40,0);
            textbox .addCommand (quitCommand);
            textbox .setCommandListener(this);
            display .setCurrent(textbox);
            
        }
        
        public void pauseApp()
        {
            
        }
         
        public void destroyApp(boolean unconditional)
        {
            
        }
        
        public void commandAction (Command choice, Displayable displayable)
        {
            if (choice == quitCommand)
            {
                destroyApp(false);
                notifyDestroyed();
            }
        }
    }
    Can any one help at all
    I just tried it using NOKIA N95 without problems. Maybe NOKIA 6300 doesn't support that
    Last edited by alluoshi; 2007-11-09 at 16:18. Reason: I missed something

Similar Threads

  1. Replies: 0
    Last Post: 2002-12-04, 15:46
  2. Http connection problem in 6310i
    By teahola in forum Mobile Java General
    Replies: 1
    Last Post: 2002-10-03, 18:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved