Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User grbrg's Avatar
    Join Date
    Jun 2005
    Location
    Munich, Germany
    Posts
    9
    Hi all,

    I' currently playing around with the location API on my N95. I tried to get the location by using LocationProvider.getLocation(), which works fine. However, without changing the settings for the MIDlet it asks the user's permission everytime, which I'd rather avoid.

    I tried to use the callback method (setLocationListener and locationUpdated), but locationUpdated() is only called once on my phone. On the emulator it works fine.

    Here's the code:
    Code:
    public void locationUpdated(LocationProvider lp, Location loc)
    	{
    		try
    		{
    			Coordinates coords = loc.getQualifiedCoordinates();
    			if (coords != null)
    			{
    				double x = coords.getLongitude();
    				double y = coords.getLatitude();
    
    				// Start thread for handling the new coordinates
                                    // (...)
    			}
    			else
    			{
    				// reset the local coordinates
                                    // (...)
    			}
    		}
    		catch (Exception e)
    		{
    			// handle the exception
                            // (...)
    		}
    	}
    What could be the reason for it? I'm catching every exception in locationUpdated() and the only things I'm doing in there is to read out the coordinates and start a thread to handle them. Anything I missed?

    Any hints would be appreciated, thanks!

  2. #2
    Registered User asmatic's Avatar
    Join Date
    Jul 2005
    Posts
    43
    Did the icon of the satellite antenna stays on the screen? or maybe it dissapears?
    Can you put here please the piece of code where you create the LocationProvider and set the listener?

    I'm having problems also with that API (on nokia 6110 Navigator), but in my case, the Satellite icon dissapears after some positions are readed

  3. #3
    Registered User grbrg's Avatar
    Join Date
    Jun 2005
    Location
    Munich, Germany
    Posts
    9
    I'm using fullscreen mode, so I don't have a satellite icon at all... Even if it did disappear - what does that mean? Have you fouond any way around that?

    The code to create the listener is quite simple actually:

    Code:
    try
    {
        this.locProvider = LocationProvider.getInstance(null);
    
        this.locProvider.setLocationListener(this, 10, -1, -1);
    }
    catch (Exception ex)
    {
        // probably no location api available
    }

  4. #4
    Registered User asmatic's Avatar
    Join Date
    Jul 2005
    Posts
    43
    It seems all ok, as far as I can see.
    I would try to specify some Criteria to test if the problem is related to some bug regarding default criteria. Also I would try default interval at the listener, just in case...

    As for the Satellite Icon.. When your app creeates a LocationProvider that uses the in-built GPS, the phone starts the GPS hardware and an Satellite antenna Icon appears on the upper-right corner. If that icon dissapears means that the GPS hardware has been switched off for some reason. That's my case.
    Even if you are running fullscreen app, you can minimize your app, go back to the "Stand-by" (main screen) screen and see if the GPS icon stays on.

  5. #5
    Registered User grbrg's Avatar
    Join Date
    Jun 2005
    Location
    Munich, Germany
    Posts
    9
    I don't have a special icon for GPS connections it seems - just the standard antenna for network connectivity.

    However, setting a criteria seems to have worked! I just set some very loose constraints and it is now working as it should. Setting hte cnstraints to null seems to cause problems on my phone... Thanks for your help!

  6. #6
    Registered User lachee's Avatar
    Join Date
    Jun 2007
    Posts
    36
    Hi

    I had seemingly similar problem two days ago. A forum member suggested me to go to Tools->Application Manager-->Your MIDlet-->Options-->Open and change the setting of "Positioning" to "Ask first time". And it worked! Hope this helps.

  7. #7
    Registered User grbrg's Avatar
    Join Date
    Jun 2005
    Location
    Munich, Germany
    Posts
    9
    Thanks for your answer, but I'd rather avoid changing the MIDlet settings - not every user is comfortable with handling them.

    However, using the callback-method resulted in the nearly same thing, asking once when the location API is activated.

  8. #8
    Registered User grbrg's Avatar
    Join Date
    Jun 2005
    Location
    Munich, Germany
    Posts
    9
    Seems I was too fast with my delight... Today, even with the criteria set and the values all set to default locationUpdated() is called only once.

    Anyone got an idea...?

Similar Threads

  1. S60 API Partnering Program
    By Nokia Ron in forum News, Announcements and Job Listings
    Replies: 9
    Last Post: 2008-04-16, 18:28
  2. Location api jsr 179 and Bluetooth GPS
    By prategiov in forum Mobile Java General
    Replies: 21
    Last Post: 2007-12-04, 23:36
  3. Location API in C++
    By preethi in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2006-08-31, 06:20
  4. Location API
    By timsohn in forum Mobile Java General
    Replies: 5
    Last Post: 2006-04-18, 15:50
  5. Location API
    By cjmarsha in forum Mobile Java General
    Replies: 0
    Last Post: 2005-08-08, 20:16

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