Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor Larry101's Avatar
    Join Date
    Mar 2006
    Location
    South Africa
    Posts
    178
    I'm trying to use the getSpeed() method in the location API. However, the only value I ever get returned is "NaN". According to the JavaDocs, this is returned when speed cannot be calculated. At first I thought this was because I was moving too slowly, but this has since proven to be incorrect, as I get NaN returned no matter what speed I'm moving at. Has anybody ever successfully used this method, or do i have to calculate the speed myself?

    Btw, the phone I'm using this on is the Nokia N95. All the other methods, like latitude and longitude work, just not speed.
    Last edited by Larry101; 2007-05-23 at 09:37.

  2. #2
    Registered User hekkoe's Avatar
    Join Date
    Jun 2007
    Posts
    5
    Yes, I've noticed the same behaviour: Location.getSpeed() always returns NaN on the N95.

  3. #3
    Registered User juarezjunior's Avatar
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,883
    Hi Larry101,

    It seems you have the right answer as it cannot be calculated.

    "Returns:
    the current ground speed in m/s for the terminal or Float.NaN if the speed is not known"


    Br,
    Juarez Alvares Barbosa Junior - Brazil

  4. #4
    Regular Contributor Larry101's Avatar
    Join Date
    Mar 2006
    Location
    South Africa
    Posts
    178
    eventually got back to working on this the other day, and realised i was just being monumentally stupid. You have to specify that you want to be able to calculate the speed and course because this isn't the default. It works fine now that I fixed that. The criteria object sent through to LocationProvider.getInstance needs to have the correct settings.

  5. #5
    Registered User juarezjunior's Avatar
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,883
    Hi Larry101,

    Yes, of course, the Criteria object is meant to be used as the configurator regarding the information you want to retrieve.

    However, check the Javadocs for setSpeedAndCourseRequired() method. It says:

    Sets whether the location provider should be able to determine speed and course. Default is false.

    It is not always true that your provider will be able to do so, it should be able to do so (Java specs always diferentiate should, must and may) as you might know.

    Br,
    Juarez Alvares Barbosa Junior - Brazil

  6. #6
    Registered User camicase82's Avatar
    Join Date
    Oct 2009
    Posts
    2
    I all ready tryed with different configuracions..and when i add something to Criteria configuration like setSpeedAndCourseRequired(true); or similar...it keeps crashing....ani ideas?!

  7. #7
    Super Contributor ingsaurabh's Avatar
    Join Date
    Apr 2009
    Posts
    572
    try dis

    PHP Code:
    Criteria cr= new Criteria();
                
    cr.setCostAllowed(true);
                
    cr.setPreferredPowerConsumption(Criteria.NO_REQUIREMENT);
                
    cr.setVerticalAccuracy(5000);
                
    cr.setHorizontalAccuracy(5000);
                
    cr.setSpeedAndCourseRequired(true);
                
    lpLocationProvider.getInstance(cr);
                
    lp.setLocationListener(this, -10, -1); 
    nd I dont know about others bt api method to get speed never returns correct speed its better to fetch the whole NMEA string and parse the value that are required form it
    Regards,
    Saurabh

Similar Threads

  1. Location Based Services - Location API - JSR179
    By aminuddin09 in forum Mobile Java General
    Replies: 9
    Last Post: 2011-02-23, 19:39
  2. S60 API Partnering Program
    By Nokia Ron in forum News, Announcements and Job Listings
    Replies: 9
    Last Post: 2008-04-16, 18:28
  3. Location API in C++
    By preethi in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2006-08-31, 06:20
  4. did Nokia series was supports the Location API
    By lakshmanraob in forum Mobile Java General
    Replies: 5
    Last Post: 2005-11-16, 04:37
  5. any nokia sdk that supports location api
    By shantanu_chawla in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2005-10-03, 16:19

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