×

Discussion Board

Results 1 to 6 of 6

Hybrid View

  1. #1
    Registered User
    Join Date
    Dec 2012
    Location
    Mumbai, Maharashtra, India
    Posts
    79

    Unhappy Facing exception during try to running my app on mobile or Remote Access Decvice...

    I am developing Location based J2ME app for my final year, for that I developed a code to access device GPS and by acquiring current place coordinates app will show a plcce on map. The code is as follows:

    Code:
    import javax.microedition.lcdui.*;
    import javax.microedition.location.*;
    import javax.microedition.midlet.*;
    
    public class GmapMidlet extends MIDlet implements CommandListener, LocationListener 
    {
        Form frm;
        Command showmap;
        LocationProvider provider;
        double latitude = 0, longitude = 0;
        Coordinates updatedcoordinates, currcoordinates;
        GmapCanvas Gmap = null;
        LocationListener listener;
        //double latitude = 18.962939, longitude = 72.837424;
        public GmapMidlet()
        {
            frm = new Form("");
            showmap = new Command("Map", Command.SCREEN, 1);
            frm.addCommand(showmap);
            frm.setCommandListener(this);
            Display.getDisplay(this).setCurrent(frm);
            //Gmap = new GmapCanvas(this, Double.toString(latitude), Double.toString(longitude));
            //Display.getDisplay(this).setCurrent(Gmap);
        }
        
        private void getGPSData()
        {
            Thread t = new Thread()
            {
                public void run()
                {
                    Criteria criteria = new Criteria();
                    criteria.setHorizontalAccuracy(MAX_PRIORITY);
                    criteria.setVerticalAccuracy(MAX_PRIORITY);
                    criteria.setCostAllowed(true);
                    criteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_HIGH);
                    try
                    {
                        provider = LocationProvider.getInstance(criteria);
                        Location location = provider.getLocation(60);
                        provider.setLocationListener(listener, 30, -1, -1);
                        currcoordinates = location.getQualifiedCoordinates();
                        if(currcoordinates != null)
                        {
                            latitude = currcoordinates.getLatitude();
                            longitude = currcoordinates.getLongitude();
                        }
                        else
                        {
                            showError("GPS is inactive or Location provider is not working properly");
                        }
                    }
                    catch (LocationException ex) 
    		{                    
                        showError("Problems with location provider! \n" + ex.getMessage());
                        ex.printStackTrace();  
                    } 
                    catch (InterruptedException ex) 
                    {                  
                        showError("Interruption in service... \n" + ex.getMessage());
                        ex.printStackTrace();   
                    }
                    catch(Exception ex)
                    {
                        ex.printStackTrace();
                    }
                }
            };
            t.start();
        }
        
        public void startApp() 
        {
            getGPSData();
        }
        
        public void pauseApp(){}
        
        public void destroyApp(boolean unconditional){}
        
        public void locationUpdated(LocationProvider Locprovider, Location loc) 
        {
            if(loc != null && loc.isValid())
            {
                updatedcoordinates = loc.getQualifiedCoordinates();
                if(updatedcoordinates != null)
                {
                    latitude = updatedcoordinates.getLatitude();
                    longitude = updatedcoordinates.getLongitude();
                }
                else
                {
                    showError("No valid coordinates found.");
                }
            }
            Gmap.updatedCoordinates(Double.toString(latitude), Double.toString(longitude));
        }
    
        public void providerStateChanged(LocationProvider Locprovider, int newState) 
        {
               if(newState == LocationProvider.OUT_OF_SERVICE || newState == LocationProvider.TEMPORARILY_UNAVAILABLE)
               {
                     showError("Location provider in out of service or temporarily unavailable");
               }
        }
        
        void showError(String message)
        {
    	Alert error = new Alert("GPS Connection Error", message, null, AlertType.ERROR);
            error.setTimeout(error.getDefaultTimeout());
    	Display.getDisplay(this).setCurrent(error, frm);
        }
    
        public void commandAction(Command c, Displayable d) 
        {
            if(c == showmap)
            {
               if(currcoordinates != null)
                {
                    Gmap = new GmapCanvas(this, Double.toString(latitude), Double.toString(longitude));
                    Display.getDisplay(this).setCurrent(Gmap);
                }
                else
                {
                    showError("Wait.... getting coordinates..");
                }
            }
        }
    }
    But when I try to run this code on Nokia E5 or Remote Device Access mobile(Nokia E71).... after clicking on on app, it shows me a message "Unhandled Exception : close application??" but when I run this code on Oracle 3.0.5 emulator.... it perfectly run without showing me any exception.
    I am not getting whats wrong with this code.... how should I solve this problem????
    Last edited by Rahul More; 2013-02-10 at 10:48.

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

    Re: Facing exception during try to running my app on mobile or Remote Access Decvice.

    if you want to use Maps on Nokia Series 40 devices, I would suggest using the Maps API for Java ME. Also you could try our Series 40 SDK and see whether the problem is shown in the emulator.

  3. #3
    Registered User
    Join Date
    Dec 2012
    Location
    Mumbai, Maharashtra, India
    Posts
    79

    Re: Facing exception during try to running my app on mobile or Remote Access Decvice.

    Quote Originally Posted by symbianyucca View Post
    if you want to use Maps on Nokia Series 40 devices, I would suggest using the Maps API for Java ME. Also you could try our Series 40 SDK and see whether the problem is shown in the emulator.
    My one friend run same code on Nokia E5 then why this code is not running..... & one one thing is that I run this code on E6, it run perfectly on that though E6 have Symbian OS (Developer platform-Nokia Belle)

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

    Re: Facing exception during try to running my app on mobile or Remote Access Decvice.

    With Symbian there are several different versions of the OS. The E5 is 3rd ed FP2, and the E71 is 3rd ed FP1, where as the E6 is Symbian^3 device, between the platform versions there could be great differencies on capabilities as well.

    Anyway, the Map API I suggested, should also work with these devices.

  5. #5
    Registered User
    Join Date
    Dec 2012
    Location
    Mumbai, Maharashtra, India
    Posts
    79

    Re: Facing exception during try to running my app on mobile or Remote Access Decvice.

    Quote Originally Posted by symbianyucca View Post
    With Symbian there are several different versions of the OS. The E5 is 3rd ed FP2, and the E71 is 3rd ed FP1, where as the E6 is Symbian^3 device, between the platform versions there could be great differencies on capabilities as well.

    Anyway, the Map API I suggested, should also work with these devices.
    Well sir... I am using Google static map API & I already develop a lot of code in Google MAP API. But I think that's not the main problem. The problem may be which mobile should I use as my target device. As I told you, its running well on one device but not on another.... You are expert,then which mobile would you recommend me as per my app...
    Last edited by Rahul More; 2013-02-10 at 10:57.

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

    Re: Facing exception during try to running my app on mobile or Remote Access Decvice.

    AS it is 3rd party service and API, I would not know its limitations nor requirements. I would suppose that if you see it working on certain platform versions, and not on others, you could always then make the decision based on testings. I would suppose the problem could be reated to Browser environment differencies, thus could be also that certain firmware versions might work differently than others.

    Anyway, as it is not our API, I don't think I would have any definite answers on where it should work and how.

Similar Threads

  1. RNR Failed: Could not access Remote Device (Exception while getting bluetooth name )
    By dayas_90 in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2012-04-12, 06:20
  2. access remote mobile file system by bluetooth(OBEX)
    By mohsenkw in forum Mobile Java General
    Replies: 5
    Last Post: 2012-01-02, 12:40
  3. Blue tooth remote access to a mobile phone
    By Zeedzkanik in forum Bluetooth Technology
    Replies: 2
    Last Post: 2009-05-06, 08:53
  4. MMA : Exception during remote invocation
    By brokendove in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2006-06-06, 05:42

Posting Permissions

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