×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    20

    JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    Hello,

    This is quite a funny situation I am finding myself in. A few days back, I wrote a simple, Midlet which captures the Lat/Lng value, and stores it in a file. I was using an E72 at that point of time. Now, when I try running the same code on a 5800, I don't get the desired output.

    1. I have not made any significant changes to the code since then,
    2. I don't have access to an E72 at this point of time, so I can't retest it on the same device,
    3. I have checked the specs for 5800, and it supports JSR-179, and has a GPS chip in it as well.

    Can anyone please help me out a little, with this?



    Code Snippet :
    Code:
    // GPS location related
    public static int GPS_horizontalAccuracy = 100;
    public static int GPS_locationFixTimeout = 60;
    
    // set the criteria and get the location provider
    Criteria criteria = new Criteria();
    criteria.setHorizontalAccuracy(test.GPS_horizontalAccuracy);
    try {
    	// marker
    	form.append("\n Entered Try-Catch Block...");
    			
    	LocationProvider locationProvider = LocationProvider.getInstance(criteria);
    			
    	// marker
    	form.append("\n Got Instance...");
    			
    	Location location = locationProvider.getLocation(test.GPS_locationFixTimeout);
    			
    	// marker
    	form.append("\n Got Locational Fix...");
    			
    	Coordinates coordinates = location.getQualifiedCoordinates();
    			
    	// marker
    	form.append("\n Got Coordinates...");
    			
    	location_str = "(" + coordinates.getLatitude() + ", " + coordinates.getLongitude() + ")";
    
    	// marker
    	form.append("\n Done!");
    } catch (LocationException e) {
    	form.append("LocationException in getLocation");
    	form.append(e.getMessage());
    } catch (InterruptedException e) {
    	form.append("InterruptedException in getLocation");
    	form.append(e.getMessage());
    } catch (IOException e) {
    	form.append("IOException in getLocation");
    	form.append(e.getMessage());
    }

    Expected Output :
    Entered Try-Catch Block...
    Got Instance...
    Locational Fix...
    Got Coordinates...
    Done!


    Actual Output :
    Entered Try-Catch Block...
    Got Instance...
    LocationException in getLocation
    Location request timed out

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    It looks that your 5800Xm is not able to get the GPS lock and hence it gives time out.

    Try OVI-maps on this device or google maps or device inbuilt location app and once you get the GPS lock in that app, try your app at the same moment, it will start working.

    Check settings, A-GPS and all other ways to get GPS lat/long should be selected in settings.

    thanks,
    Ekta

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    20

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    I checked all the settings. They are proper. I also tested on a host of other devices as well. Its STILL not working. Can anyone please suggest anything here? I am thinking, its some configuration error. There can't be much wrong with this code. Its only a bunch of API calls. Any pointers will be helpful...

    -Rohitesh.

  4. #4
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    I'd try different Criteria's... For example on some devices setting a Power Criteria will simply stop the provider providing any Locations...
    Also have you specifically tried what ektasrv has asked ? As in have you tried the standard Nokia Maps app on the device ? Does that one actually receive GPS positions ?

  5. #5
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    Rohitesh,

    Its important that you first check if the GPS chip on the device is working or not, so try OVI maps and let us know the results? are getting a GPS fix.

    thanks,
    Ekta

  6. #6
    Registered User
    Join Date
    Jun 2009
    Posts
    20

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    @ektasrv @Tiger79

    There's a small problem. I don't have access to a phone that has a GPS chip, till Monday! So, gotta wait for another day or two, for that. I will update here, as soon as I can get my hands on one.

    Cheers,
    Rohitesh.

  7. #7
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    One more thing - you should check - your code contains line --> public static int GPS_locationFixTimeout = 60;

    60 => 60 seconds.... and it has been seen that using the device in open Air, the first GPS fix may take a time around 10 to 15 mins even so increase it and try.

    Or even better try out with -1, the default timeout.

    You will notice, if you get a GPS fix on OVI map once and then if you switch to your app... you will get the fix very fast.
    Last edited by ektasrv; 2010-06-07 at 11:48.
    Thanks,
    Ekta

  8. #8
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    Sorry,
    I thought you were developing specifically on a 5800XM, which does have a GPS chip :P
    Anyways first check if the GPS is working at all, even though the chances are pretty small it might be that the GPS receiver is simply broken...

  9. #9
    Registered User
    Join Date
    Jun 2009
    Posts
    20

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    @ektasrv @Tiger79

    I tried the following, and still no positive results :

    1. First accessed Nokia Ovi Maps. Got a location fix on the map that it displayed. Exited. Then ran my app. It still couldn't get a locational fix, and gave a time out.

    2. Also increased the timeout limit to 120 (2mins), but it still didn't work.

    I am really at my wits' end. This is a simple Hello World program that I am running here. How can this fail???

    -Rohitesh

    P.S.
    * Device I am using : 5800ExpressMusic
    * GPS Settings :
    Positioning Methods : Assisted GPS (selected), Integrated GPS (selected), Bluetooth GPS (selected), Network based (selected)
    * I am running these tests outdoors, with a clear line of sight with the sky

  10. #10
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    As Ekta suggested, try to increase the time-out to 10 to 15 mins and see if your application is able to get the fix. Even 2 min's can be very less to get a GPS Fix.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  11. #11
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    Quote Originally Posted by rohiteshd View Post
    @ektasrv @Tiger79

    I tried the following, and still no positive results :

    1. First accessed Nokia Ovi Maps. Got a location fix on the map that it displayed. Exited. Then ran my app. It still couldn't get a locational fix, and gave a time out.

    2. Also increased the timeout limit to 120 (2mins), but it still didn't work.

    I am really at my wits' end. This is a simple Hello World program that I am running here. How can this fail???

    -Rohitesh

    P.S.
    * Device I am using : 5800ExpressMusic
    * GPS Settings :
    Positioning Methods : Assisted GPS (selected), Integrated GPS (selected), Bluetooth GPS (selected), Network based (selected)
    * I am running these tests outdoors, with a clear line of sight with the sky
    Hi Rohit,

    Try to test your application while Ovi Maps is runing in the background after Ovi map gets the Fix without exiting it and try time-out vaule of -1 or 30x60 = 30 mins - hope you will get the fix in your app.
    Thanks,
    Ekta

  12. #12
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    Actually instead than assuming you already have a Location like in your code I would implement the LocationListener interface...
    And simply get a Location when it's available, have a look at this wiki article :
    http://wiki.forum.nokia.com/index.ph...aining_GPS_fix

  13. #13
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: JSR - 179 LocationAPI Not Working On 5800ExpressMusic

    Try increasing the HorizontalAccuracy to 5000 and check.

    And yes, just like Tiger I would also recommand using LocationListener mechanism as people have faced lot of problems realted to time-out while using location polling methods to get the location from location provider.

    Fro API doc you can see:
    setLocationListener

    public abstract void setLocationListener(LocationListener listener,
    int interval,
    int timeout,
    int maxAge)
    Adds a LocationListener for updates at the defined interval. The listener will be called with updated location at the defined interval. The listener also gets updates when the availablilty state of the LocationProvider changes.
    Passing in -1 as the interval selects the default interval which is dependent on the used location method. Passing in 0 as the interval registers the listener to only receive provider status updates and not location updates at all.

    Only one listener can be registered with each LocationProvider instance. Setting the listener replaces any possibly previously set listener. Setting the listener to null cancels the registration of any previously set listener.

    The implementation shall initiate obtaining the first location result immediately when the listener is registered and provide the location to the listener as soon as it is available. Subsequent location updates will happen at the defined interval after the first one. If the specified update interval is smaller than the time it takes to obtain the first result, the listener shall receive location updates with invalid Locations at the defined interval until the first location result is available.

    The timeout parameter determines a timeout that is used if it's not possible to obtain a new location result when the update is scheduled to be provided. This timeout value indicates how many seconds the update is allowed to be provided late compared to the defined interval. If it's not possible to get a new location result (interval + timeout) seconds after the previous update, the update will be made and an invalid Location instance is returned. This is also done if the reason for the inability to obtain a new location result is due to the provider being temporarily unavailable or out of service.
    For example, if the interval is 60 seconds and the timeout is 10 seconds, the update must be delivered at most 70 seconds after the previous update and if no new location result is available by that time the update will be made with an invalid Location instance.

    The maxAge parameter defines how old the location result is allowed to be provided when the update is made. This allows the implementation to reuse location results if it has a recent location result when the update is due to be delivered. This parameter can only be used to indicate a larger value than the normal time of obtaining a location result by a location method. The normal time of obtaining the location result means the time it takes normally to obtain the result when a request is made. If the application specifies a time value that is less than what can be realized with the used location method, the implementation shall provide as recent location results as are possible with the used location method. For example, if the interval is 60 seconds, the maxAge is 20 seconds and normal time to obtain the result is 10 seconds, the implementation would normally start obtaining the result 50 seconds after the previous update. If there is a location result otherwise available that is more recent than 40 seconds after the previous update, then the maxAge setting to 20 seconds allows to return this result and not start obtaining a new one.

    Parameters:
    listener - the listener to be registered. If set to null the registration of any previously set listener is cancelled.
    interval - the interval in seconds. -1 is used for the default interval of this provider. 0 is used to indicate that the application wants to receive only provider status updates and not location updates at all.
    timeout - timeout value in seconds, must be greater than 0. if the value is -1, the default timeout for this provider is used. Also, if the interval is -1 to indicate the default, the value of this parameter has no effect and the default timeout for this provider is used. If the interval is 0, this parameter has no effect.
    maxAge - maximum age of the returned location in seconds, must be greater than 0 or equal to -1 to indicate that the default maximum age for this provider is used. Also, if the interval is -1 to indicate the default, the value of this parameter has no effect and the default maximum age for this provider is used. If the interval is 0, this parameter has no effect.
    Throws:
    java.lang.IllegalArgumentException - if interval < -1, or if (interval != -1) and (timeout > interval or maxAge > interval or (timeout < 1 and timeout != -1) or (maxAge < 1 and maxAge != -1))
    java.lang.SecurityException - if the calling application does not have a permission to query the location information
    Thanks,
    Ekta

Similar Threads

  1. JSR 179 working on N95?
    By chrisgnicholas in forum Mobile Java Tools & SDKs
    Replies: 3
    Last Post: 2009-01-29, 08:10
  2. JSR 179 with no GPS
    By Larry101 in forum Mobile Java General
    Replies: 1
    Last Post: 2008-05-28, 15:10
  3. No rule to male target
    By arayappan_it in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 4
    Last Post: 2008-02-28, 10:49
  4. E61, CDC & JSR 179
    By jdesjean in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2007-06-27, 13:41
  5. JSR 179 Implementation
    By gruntzd in forum Mobile Java General
    Replies: 1
    Last Post: 2007-02-26, 07:31

Posting Permissions

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