Trouble getting GPS coordinates in the Simulator

Here is the code I use to get the coordinates of the GPS by train. It seems that every time that it expires and ends by 0 for the latitude and longitude of return even if I put together a location in my simulation-> GPS location... window and entered in the Options-> advanced-> GPS-> was cool my main application class, this function is called by a button.

public void GetCurrentLocation() {         Criteria ct = new Criteria();            //ct.setAddressInfoRequired(false);          //ct.setAltitudeRequired(false);         ct.setCostAllowed(true);        ct.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);        ct.setVerticalAccuracy(Criteria.NO_REQUIREMENT);        ct.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);        //ct.setPreferredResponseTime(10000);        //ct.setSpeedAndCourseRequired(false);

        try {            myLP = LocationProvider.getInstance(ct);            myLP.setLocationListener(new myLocListener(this), -1, -1, -1);        } catch (Exception ex) {            return;        }    }

public void GotLocation(Location myLoc) {        if(myLoc != null) {            QualifiedCoordinates qc = myLoc.getQualifiedCoordinates();            //Call webservice here.        }    }

In the myLocListener.java

package net.gasbot;

import javax.microedition.location.*;

public class myLocListener implements LocationListener{    GasBotScreen gb;

    public myLocListener(GasBotScreen gb)    {        this.gb = gb;    }

    public void locationUpdated(LocationProvider provider, Location location)    {        QualifiedCoordinates qc = location.getQualifiedCoordinates();  //I set a breakpoint here, but it rarely gets called, and when it does, the coordinates are both 0.        provider.setLocationListener(null, 0, 0, 0);        gb.GotLocation(location);    }    public void providerStateChanged(LocationProvider provider, int newState)    {

    }}

Can you get it someone please let me know what I am doing wrong? I'll put the listener null once it gets a set location to update as I need it only once. I also tried to use the.getLocation(-1) and it does not work either. Is there something wrong with my Simulator? Or just something wrong with my code?

I don't understand your code, in fact.  Why are reset you the listener inside the listener?

In addition, you "eat" the exception where you get the provider. He is a likely area of failure, so I would put a trace and trace any exception.

Another thing to try: try to set criteria to null when you get the provider: gives you the provider "by default".

Tags: BlackBerry Developers

Similar Questions

  • convert gps coordinates in the text of the actual location

    In the card module, I have information for photo tagged gps, including research actual address information. My question; is it possible that I may transfer this information to address (not gps coordinates) for the print module search without "copy / paste"?

    Forgive me if I'm stating what is obvious, but if you have your image georeferenced and reverse georeferenced it (i.e. got city, country, etc.) info, and that is stored in the appropriate places (look in the metadata Panel 'location'), then that's all you need to do. You are always in Lr if the info is still there. If your wondering how to view the slide show, then it's as simple as choosing a text overlay, and then selecting the metadata you want in the overlay. In this case, to say 'city '.

  • GPS coordinates in the search for the card Module box

    Can you put GPS coordinates in the search box of card module CC Lightroom? If so, what is the format? Support said it was for the names. I thought that I used to be able to do about 6-8 months ago.

    You can put the lat/long coordinates in the map search box:

    In my view, that he accepts all formats that Google agrees (although I have not tried all).

  • GPS works on the Simulator, but not on phone

    Hello

    I created a simple application that gets the location of the device's GPS. The app works perfectly on the Simulator, but I have no GPS updates on the phone. I've been in options-> device-> Location.Settings on the phone and can see the GPS updates are coming through. But the app says there is no valid received GPS.

    I tried it on BlackBerry 9800... All I get on the phone is 'pending GPS update', that my app is displayed if no valid GPS don't trouble is received.

    Thanks in advance.

    Kevin

    C criteria = newCriteria();

    c.setHorizontalAccuracy (Criteria.NO_REQUIREMENT);

    c.setVerticalAccuracy (Criteria.NO_REQUIREMENT);

    c.setCostAllowed (true);

    c.setPreferredPowerConsumption (Criteria.POWER_USAGE_HIGH);

    LocationProvider lp;

    Try

    {

    LP = LocationProvider.getInstance (c);

    if (lp! = null)

    {

    lp.getLocation (timeout);

    lp.setLocationListener (newMyLocationListener(),-1, 1, 1);

    }

    on the other

    {

    Dialog.Alert ("sorry - your phone does not support GPS");

    }

    }

    catch (Exception e)

    {

    System.

    Err.println (try ());

    }

    }

    private class MyLocationListener implementsLocationListener

    {

    public voidlocationUpdated (LocationProvider provider, a place)

    {

    if (location! = null& location.isValid ())

    {

    QualifiedCoordinates qc = location.getQualifiedCoordinates ();

    Try

    {

    Lat string = Double.toString (qc.getLatitude ());

    String long = Double.toString (qc.getLongitude ());

    UpdateScreen ('place of registration successfully');

    }

    on the other

    {

    UpdateScreen (' Failed to day location ');

    }

    }

    catch (Exception e)

    {

    }

    }

    on the other

    {

    UpdateScreen ("waiting for GPS update");

    }

    }

    public void providerStateChanged (LocationProvider provider, intnewState)

    {

    TODO: If the provider has been disabled, then disable the reporting

    }

    }

    Try the examples of programs that you can find here:

    http://supportforums.BlackBerry.com/T5/Java-development/BBM-shareContent/m-p/1796237#M203486

    or here:

    http://supportforums.BlackBerry.com/T5/Java-development/simple-location-API/Ta-p/1145951

    See if these work on the unit.  If they do, look at the code listed and compare with yours.

  • How to get GPS coordinates on a GSM device

    I need to be able to get patches on a GSM device and the requirement is to get them as quickly as possible, but it turns out that I can not a fix at all.

    I followed all the instructions and tutorials, video... and I tested with the diagnostic tool of GPS on two different devices GSM - torch 9800(os 6) and Pearl 9100 (os 5)

    They might fail with all means, I tried both for single or multiple corrections.

    I tried to pass in the area and give him more time to (200 seconds) to get that fix and it either gets no fix at all or the hotfix is not valid.

    In my view, that the GPSDiagnostic tool try all of them. Anyone can share their experience with GPS.

    My previous tests GPS gets very rarely a valid solution and I'm wearing something like 95% don't rate. This is for all types of tests - indoor, outdoor...

    His frustration.

    It turned out that the geographical location where I was a poor coverage or the phone just got stuck. After I let him try to get the coordinates for a few hours, he has them eventually and since then, it works well after several reboots.
    It is the same for the other phone.
    I don't know why they have been unable to get the coordinates, but it seems fine now.

  • Get a coordinates of the screen control

    Hi all
    I have a small problem... I would like to display a ContextMenu by clicking a button on the left. I got the part, but the context menu is displayed at the position of the mouse.
    What I would like is to see the menu on the right side of the button (buttonXmax) but I can't find the absolute X the value of a control.

    Any ideas?

    Thanks before,
    Jonathan
    import javafx.application.Application;
    import javafx.event.*;
    import javafx.scene.*;
    import javafx.scene.control.*;
    import javafx.stage.*;
    import javafx.geometry.Side;
    
    public class ContextM extends Application {
    
        public static void main(String[] args) {
            Application.launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) {
            Group root = new Group();
            Scene scene = new Scene(root, 300, 250);
    
            final ContextMenu contextMenu = new ContextMenu();
            final MenuItem menuItem1 = new MenuItem("MenuItem1");
            final MenuItem menuItem2 = new MenuItem("MenuItem2");
            contextMenu.getItems().addAll(menuItem1, menuItem2);
            final Button buttonXmax = new Button();
    
            buttonXmax.setLayoutX(100);
            buttonXmax.setLayoutY(80);
            buttonXmax.setText("Get context");
            buttonXmax.setOnAction(new EventHandler() {
    
                public void handle(ActionEvent event) {
                    contextMenu.show(buttonXmax, Side.RIGHT, 0, 0);
                }
            });
            root.getChildren().add(buttonXmax);
            primaryStage.setScene(scene);
            primaryStage.show();
        }
    }
    
  • Change the GPS coordinates

    Is this possible in LR4 to change the GPS coordinates of the individual images?

    Also, if you drag and drop a "marker" in the map, which changes the coordinates of a photo as well. Does not work if the marker represents more than one photo, these markers cannot be moved.

  • LocationListener Vs getLocation GPS coordinates?

    Hello

    Just a quick question.

    I've read several times that the frequent difficulty, to use a LocationListener instead of lp.getLocation (repeated).

    What can be considered "frequent"?

    All the examples I've seen get GPS coordinates every 5 or 10 seconds.

    On my particular application, I do a lp.getLocation () every 15 minutes... but I want to change that to 5 or 10 minutes.

    I have two solutions work, I just would like to know which should I use for a fix every 5 or 10 minutes?  One who takes fewer resources battery and device?

    Thank you!

    I think that locationprovider would be nice in this case.

  • GPS coordinates of pictures is not displayed

    Right click on the thumbnails of the pictures and selecting Properties > details does not display GPS coordinates of the photos.  Not only the data, but the data field itself.  And that's for each photo, even those taken on my own phone with the settings > system > location set in place, as well as photos taken with several of my friends phones.  And the coordinates are displayed in Picassa, either.  Why are they not the GPS coordinates showing, and how can I make them display?

    You should look on your phone (if it's Android) and see if under settings > location you have "Tag Photos or videos with location" lit.  The only reason the GPS coordinates show is if the data is not present in the image file.  This seems to be the case with you, like Windows or Picasa is to see GPS information in the metadata.

  • Ripple error deployment to the simulator fails

    Hi, I'm taking my first steps in development of BB. My company asked me to do a BB - app with IBM work lamp. I installed the SDK Webworks, waving and a BB Simulator (model 9900). I also added the necessary environment variables on Windows 7. I did a hybrid application that contains the html, css and javascript. After the creation and deployment of the local console of the work light, I can open the app with ripple. After the start of the services, I can pack and start the work of packing App., but the deployment on the simulator fails. I get the following error:

    Spawning Simulator 9900 - 7.0.0.384...

    stderr: CreateProcessW: the system cannot find the specified file.

    Exit take flight for 9900 - 7.0.0.384

    I have seen this error on the forum, but others had when packing. I get it through to the Simulator. Can someone help me with this?

    I solved my problem by choosing another Simulator, 9860-model. Ripple now starts the Simulator, which is extremely slow. The hotswap function crashes immediately, but the Simulator works with my application. However I am concerned that blackberry development tools is so buggy. But as long as I don'tn use the simulator that's good enough.

  • App won't start with the Simulator

    Hello

    I met a lot of mistakes trying to get that deployed on the Simulator, most of them addressed by other posters.  I use the 0.9.3 beta version of the Simulator.

    However, now I have this problem that I can not find the answer.

    Flash Builder will not launch the application.  The following text is displayed in the console:

    Using the default icon: C:\Program Files (x 86) \Adobe\Adobe Flash Builder 4\sdks\blackberry-tablet-sdk-0.9.2\bin\... \samples\icons\blackberry-Tablet-default-Icon.png
    Package created: C:\Development\Mobile\PuzzletsPlaybook/PromoAppPlaybook.bar
    Picked up JAVA_TOOL_OPTIONS:-Xmx1024M
    Sending request installation and launch...
    Error: Username or password is invalid or not specified or time on the device is out of sync

    I tried this FB parameter to use the Playbook password and not to use it, and fail both ways.

    How can I fix it?  The Playbook must have a pw but I can't start my application.

    Also, I use VM Player as host of Simulator, the Playbook should be run in the Simulator or is it launched by FB?  I tried two ways does not.

    Thank you!

    Hey,.

    It seems that you are using the latest sim but more old SDK. try to update your Tablet OS SDK of AIR and then try to deploy again. using the versions do not match led to mistakes in the past.

    Here is the link to the latest SDK:

    http://us.BlackBerry.com/developers/Tablet/Adobe.jsp

    Good luck!

  • Mobile Lightroom does not synchronize GPS coordinates

    I use Lightroom on Android mobile v.1.2. When I take a picture (using the default camera app), the image has GPS coordinates into the EXIF data. However, the version that is synchronized with the desktop app (2015.1.1) does not work.

    What Miss me?

    At least some Android software, including the default camera app, have a bug and do not save GPS information in strict compliance with the standard way, causing the LR to ignore:

    Lightroom: Throw my Nexus 5 photos GPS info when I change all the metadata

    If you want to confirm that this is what is happening with you, among the photos Android download Dropbox or similar and post the link here, and I'll take a look.

  • How to get the current GPS position of the BlackBerry emulator?

    Hello! all, I am writing a simple program to get the current coordinates of GPS (Latitude, Longitude) in BlackBerry.

    Criteria criteria=new Criteria();
            criteria.setHorizontalAccuracy(500);
            criteria.setVerticalAccuracy(500);
            LocationProvider locationProvider=LocationProvider.getInstance(criteria);
            Location location=locationProvider.getLocation(60);
            QualifiedCoordinates coordinates=location.getQualifiedCoordinates();
            System.out.println("Latitude : "+coordinates.getLatitude()+" Longitude : "+coordinates.getLongitude());
    

    But, I couldn't get the latitude and longitude. It returns 0 (zero) for the two coords.

    PLS, suggest me the solution.

    The 9000 Simulator has GPS simulation. In the "Simulation" of the Simulator menu, select "GPS". There is an already defined test site, you will need to select this place.

  • How to transfer GPS coordinates from one film to the other using Applescript?

    When I export a movie from the Photos app and read it in Quicktime Player.

    QTP then gives me the location where the film was saved:

    Now, I would like to set the location of another movie in exactly in the same place, using Automator or Applescript.

    Could someone please give me a tip how to do this? Is this possible?

    The reason why I want to do is I want to improve an Automator workflow, I wrote which helps the compression of movies that I keep in my library of Photos (that is, to reduce the size of the file).

    The workflow, you can find here (http://www.informatik.uni-bremen.de/~zach/software/index.html#compress_movies_in _photos), if you are interested.

    Tips, pointers and suggestions will be highly appreciated.

    Best regards

    Gabriel.

    Hard to do standalone AppleScript, but easy if you install a copy of exiftool

    Then, you can extract the GPS coordinates via something like:

    the shell script "" / usr/local/bin/exiftool - GPSPosition some. "." JPG ".

    You can also use exiftool to copy the tags of one file to another:

    the shell script ' / usr/local/bin/exiftool - tagsFromFile - GPSLongitude source.jpg - GPSLatitude dest.jpg.

    This will copy the tags GPS Longitude and Latitude of source.jpg to dest.jpg

  • GPS coordinates that are deleted by the Application Photos

    Since June 2015, when I copy a photo in the Photos on my MacBook Pro app, it seems to remove the GPS data. More specifically,.

    • The photos are taken by a Nexus 5 phone. I don't have this problem when the pictures come from my partner's iPhone.
    • I have a MacBook Pro from 2014 (not retina that base).
    • I always run the latest version of Photos. The problem seemed only to appear in June last year. Before added photos then appear to be fine.

    I checked the original version of the photo that I stored in (Finder), and this seems to be very well. Only once I have copy in Photos and then look in the file that comes out, the GPS data are gone.

    Why is what happens, and is there a solution?

    Only once I have copy in Photos and then look in the file that comes out, the GPS data are gone.

    How do check you "files that come out?

    • The GPS coordinates are removed, if you export Photos photo with "file > export > export original unmodified for a single photo?
    • The GPS coordinates are removed, if you export Photos photo with "file > export > export 1 photo" and select "include location information?

    If you do not file > export, but the menu share, GPS information will be deleted, unless you enable 'Include the location information for published items' in the Photos > Preferences > general Panel.

Maybe you are looking for

  • Project disappeared after that put 10.2.3 update

    Yesterday morning, I upgraded 10.2.3 and then started working on a new project. Today I continued my work and then, when the program was lagging behind a bit, I closed and reopened. The project was empty. The event, all the imported data and selectio

  • Lost my SD memory card

    I accidentally inserted into the slot of the drive just above the slot SD - how to get out?

  • Plug & Play does not work - cell HP Pavilion dm4 - Windows 7

    These three issues all occurred as soon as I uninstalled Norton (demo of limited duration which came with my PC) and installed AVG. I think they are all symptoms of the same underlying issue. 1. the popup saying "no amd graphics driver is installed o

  • HD filled too fast

    I am running XP SP3.I have a HD 500 GB that I cloned a 160 GB HD on. After a few weeks he filledindoor ~ 11 GB of full. With the help of SequoiaView, I found a directory named "\R_TFXBp4oklklD!z+C".who said 76.4 GB. It contains 365 files 216 MB each.

  • WRT310N V1 - how to fix the firmware after installation of the firmware v2 on v1 hardware. * SOLVED *.

    Hello CAVEAT! THIS IS AN ADVANCED TECHNIQUE TECH SOLUTION WITH OUT OF WARENTEE ROUGHTERS. IF LINKSYS SUPPORT CAN HELP YOU, USE IT ADAPTS ITS SERVICES TO FIRST! THIS PROCEDURE MAY OCCUR IF PURMADENT LOSS OF USE OF YOUR MORE ROUGH. THIS WORKED FOR ME,