GPS location. IsValid() always false.

I did some research and reading, but do not have a good understanding of the way which he GPS libraries works (or why it doensn can't work properly for me )

provider init code

public static LocationProvider getLocationProvider(){
            LocationProvider locationProvider = null;
            try{
                Criteria criteria = new Criteria();
                criteria.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
                criteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
                criteria.setCostAllowed(false);
                criteria.setPreferredPowerConsumption(Criteria.NO_REQUIREMENT);

                locationProvider = LocationProvider.getInstance(criteria);
            }catch (LocationException le){
                locationProvider = null;
            }

             return (locationProvider);
        }

define a listener (5 minutes interval):

locationProvider.setLocationListener(new LocationListenerImpl(), 5 * 60, -1, -1);

listener:

  if(location.isValid()){
                                                                                    longitude = location.getQualifiedCoordinates().getLongitude();
                            latitude = location.getQualifiedCoordinates().getLatitude();
                                                    }
                        else{
                            if (_unvalidFixes++ == 3){
                                                                ResetProvider(provider,5));
                                _unvalidFixes = 0;
                            }
                                                    }

Reset

 private void ResetProvider(LocationProvider provider, int IntervalInMinutes){
                            provider.setLocationListener(null,0,0,0);
                provider.reset();
                try {
                    Thread.sleep(20000);
                } catch (Exception e) {
                    LogFile.WriteLogEntry("LocationListenerImpl.ResetProvider: Sleep Exception", LogFile._DEBUG);
                }
                provider.setLocationListener(this, IntervalInMinutes * 60, -1, -1);

            }

providerStateChanged (never shot...)

  public void providerStateChanged(LocationProvider provider, int newState)
            {
                AppSettingsStorage appSettingsStorage = AppSettingsStorage.getInstance();

                switch (newState) {
                                        case LocationProvider.TEMPORARILY_UNAVAILABLE:  

                        ResetProvider(provider,5
                        break;
                }

            }

the result of this code is that location.isValid ()) is always wrong, and I don't know why ,.

Thank you!

I've implemented my own thread getLocation and use (such as Peter suggested on thread referenced..) and now it works fine,

I have a thing for big (I don't know which size - 5 minutes in my case-) intervals is a better alternative...

(or maybe a good understanding of the parameters of setLocationListener...) ),

Tags: BlackBerry Developers

Similar Questions

  • Current GPS location

    Hello

    To get the current GPS location, I tried with this code, but doesn't seem to work

     private void testGPSLocation(){
            Thread t = new Thread(new Runnable() {
    
                public void run() {
                    //GPS Location
                    try{
                        LocationProvider provider = LocationProvider.getInstance(null);
                        Location loc = provider.getLocation(180);
                        Coordinates self = loc.getQualifiedCoordinates();
                        if (self != null)
                        {
                            double longitude = self.getLongitude();
                            double latitude = self.getLatitude();
                            System.out.println("longitude "+ longitude);
                            System.out.println("latitude "+ latitude);
                        }
                    }catch(Exception ex){
                        ex.printStackTrace();
                        System.err.println(ex.toString());
                    }
                }
            });
    
            t.run();
       }
    

    I tried to run GPSDemo of the samples provided by BlackBerry... but still he always gives the Longitude/Latitude/Altitude values by '0 '. I am running on BlackBerry 9530/9630. Are there settings need to be changed?  There is a possibility to enter the name of the server and I put my PC (localhost)... but still the same address. Any help on this would be appreciated.

    Thank you

    -DESTREEZ

    Large.

    Please check the thread "resolved".

  • Problem of GPS location after updating to IOS 10

    Anyone have problems with GPS location problem after update from IOS10?

    I drove Baltimore DC Regan airport, I tried with apple and Google map yesterday map, location was far from the highway, he could not determine where we are, we were on the road, but he kept us showing that we were on a local road to the highway.  Could not find 90% of time on my road.  Finally, I have to use my phone to brother with IOS9, we were fortunate that it has not updated to the most recent IOS 10.

    I wonder if anyone has the same problem after the update.

    Hello yinchiu85,

    I understand that your iPhone seems to have a hard time determining its location precisely. Fortunately, there are a number of steps you can take to help improve the accuracy of the information.

    Improve the accuracy of GPS

    GPS accuracy depends on the number of visible GPS satellites. Location of all visible satellites can take several minutes, with accuracy gradually increasing over time. To improve the accuracy of the GPS:

    • Make sure that you set the date, time and timezone correctly on the device in settings > general > Date & time. If possible, use the value automatically.
    • Keep a clear vision in several directions. Walls, vehicle roofs, buildings of great height, mountains and other obstacles can block the line of sight to GPS satellites. In this case, your device uses Wi - Fi or cellular networks to determine your position until the GPS satellites are still visible.

    If your iPhone is still unable to pinpoint your position, the next step would be to restore location Services.

    If you want to reset all settings to factory default location, go to settings > general > reset and tap reset card and privacy. When your location and privacy settings are reset, apps will be stop using your location until you grant them permission.

    On privacy and location in iOS Services 8 and later versions
    https://support.Apple.com/en-us/HT203033

  • Highway with GPS Locator 2013

    Hello... Highway 2013 with GPS Locator accepts the format longitude and latitude to find addresses in continental Europe. Also will it store tagged and entered multiple, as does Google Earth in this format?

    It is my intention to travel throughout Europe in my camper and want to connect ALL gites recognized beforehand. When I'm a useless to refer to a book for this information area.

    The highway 2013 forums are here: http://social.microsoft.com/Forums/en-US/home?forum=streetsandtrips

  • I have Windows XP. I am trying to download Microsoft Streets & Trips 2009 / with GPS Locator.

    I have Windows XP. I am trying to download Microsoft Streets & Trips 2009 / with GPS Locator. A notice appears stating (format not supported). Help, please.

    Hello

    Check with the streets and the support of the TRIPS Agreement.

    Streets & Trips
    http://www.Microsoft.com/streets/en-us/default.aspxp

    Streets & Trips - help and Support
    http://www.Microsoft.com/streets/en-us/support-and-training.aspx

    Streets and travel community
    http://www.Microsoft.com/streets/en-us/community-and-news.aspx

    Streets and travel Forum
    http://social.Microsoft.com/forums/en-us/streetsandtrips/threads

    Support for MapPoint, streets & trips and Highway
    http://support.Microsoft.com/ph/851

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • Cannot find GPS location

    Hello

    In recent weeks, I have a very annoying problem with my Sony Z3 Compact. It shows the GPS location very wrong even when I'm out. I already tried most of the solutions that have been posted in this community, but nothing helped. Also when I use applications such as the State of the GPS and the Toolbox, the gps is not able to pinpoint my location. It shows that there are satellites, but it does not connect with them.

    Please does anyone have a solution? Because with the pokemonGo and other fitness tracking apps it becomes impractical.

    Hello

    I contacted just a local repair center (an independent) and I got the answer next back on the problem:

  • Can I switch to Streets & Trips with GPS Locator 2010 free if I already have the version of 2005?

    Can I switch to Streets & Trips with GPS Locator 2010 free if I already have the version of 2005?

    Hi Little rebel,

    To upgrade Microsoft Streets & Trips with GPS Locator 2005, you just buy the new version of the software, streets & trips 2010. Hardware (GPS Locator) is continuing to function.

    Review: Streets & trips

    Community of users of streets & trips

    Tips & tricks for streets & trips

    Laptop GPS World

  • To improve the streets & trips 2008 to 2010 and use GPS Locator

    Original title: I streets and trips 2008 + GPS Locator. Can I upgrade to 2010 and continue to use the GPS Locator even connected to the USB port?
    I streets and trips 2008 + GPS Locator. Can I upgrade to 2010 and continue to use the GPS Locator even connected to the USB port?

    It is the instance of Vista installation.

    http://www.Microsoft.com/communities/newsgroups/en-us/default.aspx?DG=Microsoft.public.streets-trips

    Discussions in Streets and Trips

    Try the discussion above for your question.

    See you soon.

    Mick Murphy - Microsoft partner

  • GPS location works Simulator, but does not work in the device

    Hi all,

    I have problem with GPS location.

    I have the button through which I can get the latitude and longitude in Simulator via LocationProvider class.

    His work very well in the Simulator, but giving is not the result in the unit.

    I use Storm 9530 devices and curve 8830.

    Thank you

    Valter

    Thanks for your support,

    Finally, I found my location.

    The steps are:

    As a first step BBDeveloper mentioned

    Options of-> advanced-> GPS Options

    Now,.

    Start the application maps

    Select Menu-> start the GPS Navigation

    or

    Find the location-> where I am

    It will activate the GPS.

    Thank you and best regards,

    Valter

  • Extract the GPS location in the device

    Hi all

    I want to get the GPS location as soon as possible. I use the blackberry 5.0 version. When I use the blackberry Simulator, I am able to read the current GPS position, but when I installed this application on my device, device is unable to get the GPS location. It is showing error and also I am not able to detect the error.

    Neeraj Chauhan

    Try this http://supportforums.blackberry.com/t5/Java-Development/How-to-get-Current-GPS-Location-from-the-Bla...

  • Download other store apps that require a GPS location leads to error messages.

    Original title: Maps
    My position has stopped working over the weekend. Download other store apps that require a GPS location leads to error messages. What have I done?

    Hello

    -What are the error messages that you receive when you download apps? (This will help us find the cause of the problem)

    We will check your zone settings, if they are configured incorrectly to correct us and check if this solves the problem.

    a. on the start screen, enter the Date, press or click settingsand then press or click on define the date and.

    b. the Date and time tab, tap or click on change of time zone.

    c. check if the zone settings are right depending on your region. If you find not bad, change it accordingly and click on apply, Ok.

    Also to synchronize the time on the computer with Internet server by using the step below:

    a. on the Internet time tab, tap or click on change settings.

    b. check the box synchronize with a time server Internet and then tap or click Update now.

    Restart the computer and check that it works very well. If you experience additional problems, you can reply to this post.

  • Not on GPS Locator

    My centro line red if GPS Locator icon it. IM assuming this means that is is not on. How he turned on? Help, please...

    SOONERSTEVE wrote:
    My centro line red if GPS Locator icon it. IM assuming this means that is is not on. How he turned on? Help, please...

    It's on page 93 of your manual (can be on CD):

    Go to the screen of the phone, press the Options Menu > phone Preferences, change the '911 only' to 'location '.

    It work?

    Message is about: Treo 800w (Sprint)

  • Map screen: assign the same GPS location to a 'rare' image group

    Let's a have a buch of photos that were taken in the same place at different times. The images are scattered throughout the fimstrip and might even belong to different collections in the same catalog (or even different catalogs?). What is the best way to assign the same GPS coordinates to all these photos using the map screen?

    Of course, the direct way to do is to carefully select all of these photos in the Filmstrip, and then click the desired location on the map. It is problematic for reasons more than one. First of all, it is difficult to scroll the whole band and choose the photos one by one. Second, if I acccidentally miss one or two photos, I have to start all over again.

    The best way would be a sort of copy / paste appproach: copy the desired location in the Clipboard (another image or directly from the map) and then paste it on the desired images one by one or, better, on groups of images. A feature that, at first seems promising in this respect is the field of text input on the right that contains the GPS coordinates in the form of text. It is editable, which means that I can copy the coordinates (as text) of an image and paste it in the same field from another image. However, this unfortunately does not guarantee that images will end up with identical locations: the image that received the new coordinates could (and will be) end up with a slightly different location in terms of the image of the "donor". This means that the coordinates are stored internally with a precision greater than their representation in the text entry field.

    So, what are the other options?

    In the grid, select the "donor" photo, and then ctrl-click to select the photos of 'recipient '. Then synchronize the metadata, including the GPS location and any other fields that you want to synchronize. It's the equivalent of copy and multiple - Lightroom paste.

    This works only in a single catalog. It will not work in several catalogs (which of course is one of the many reasons why many people use a single catalog for all of their photos)

  • BlackBerry Smartphones GPS LOCATION

    I've been working on trying to get my BlackBerry Torch to get an accurate GPS position. I go to Options > device > location settings. GPS DATA source is: GPS device, location Services: location, location data: Enabled and location service activated. I go to the menu and click Refresh the location. I then wait for a future situation. As the address I get a number that does not exist.  The street I live on that is only 1 block long and gives the house number is not valid.  He said that precision be 6,97 m.

    I tried out and refreshing my position several times, tired standing in different places. Right now it shows 6 satellites. I tried to disable location data, before you turn off the location helping. I see no difference.  I tried the things listed on this page: http://blog.telenav.com/blog/2011/01/common-fixes-for-att-navigator-on-the-blackberry-9800/ nothing seems to help.

    I plugged a location on ATT Navigator and shown both States the time to get there is 15 to 20 minutes on the real time it takes to get there.

    I reinstalled ATT Navigator today to see if that would help. But he did not.  The physical location seems close enough, but when I plug my actual address, it shows a different location. More than 88 meters off the coast. Very different 6,97 m.  For now, I'm sitting in a Chair and he shows me move on to the next Street and back. I have the most up to software date for my phone.

    Is it possible that I can get the GPS working properly?

    Tammie

    Probably, the GPS works correctly, and your street is lot numbered.

    Let me explain: my house is located at street number 35 XXXX Street, although we are at the end of the block.

    So, my GPS, while at home, always puts to 99 number XXXX Street.

    It's because many of street follows a set pattern begins by xx1 and ending with x 99 in any block of data.

    Thus, our street should look like this.

    99----------------35------------------1

    When it actually looks like this:

    35----------------17------------------1

    Is that helps explain?

    Insofar as sitting in your Chair, GPS get you moving... because you're not outside well to the satellite showing, it is guestimating where you are.

  • Why the network location is always locked?

    I use locations 'House' and 'work '. I never put on automatic because the well, that simply never works.

    Why should I enter my password every time I want to change the location? I never lock back, let always unlocked. I have no restart or logout to make that happen, close preferences and open it again. It is locked again.

    Does not have this problem in Yosemite on this MBA; not I have it on Yosemite on my mini... What is the problem with El Capitan?

    In the security & privacy preferences window, please open settings, then click on the Advanced button and uncheck the box marked

    Need administrator password to access the lock settings

Maybe you are looking for

  • is it possible to improve the Macbook Pro early 2011 2 GB + 2 GB to 8 GB + 2 GB RAM?

    Hi, I am currently using Macbook Pro 13 inch early 2011 (2.3 GHz Intel Core i5, Intel HD Graphics 3000 512 MB) and it feels really slow to run several design takes the same time, so I think it's maybe a good time to upgrade it's RAM. My friend gave m

  • Need a recommendation for a second firewall router

    I have currently a second router connected to the LAN port of the #1 router/WiFi in order to create a firewall between the Local area network of my #1 WiFi router and a PC which is connected by a cable Cat5 to the second router. This second router ha

  • Tile label/icon disappeared

    Victory 8.1 RT Yesterday, the tile for office outlook has become empty - no text, no icon. Tapping opens outlook. I tried unpin it and it repinning from apps by display name (where the tile is shown with text and icon) it repinned, but as a white blu

  • How do I delete the system folder in the folder of the computer [SOLVED by myself]

    Top quality: https://SkyDrive.live.com/redir?RESID=4D402F7353A7A0F6! 13318 & authkey =! AJLc-2jWpQtk3w8 & v = 3 As you can see, it is not an option to remove this Chinese folder, it is also empty. I believe that I have this record of this cloud Chine

  • What are the causes "error of file photoshop-37".

    I saw a post for this problem 4 years ago, but he had no answer. So I was hoping a response has resurfaced since then.When you import a menu again in again in Photoshop, you receive this error message.  I start with a submenu of model again, making m