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.

Tags: BlackBerry Developers

Similar Questions

  • Play video works on the Simulator, but not on phone

    Hello

    I created a simple application that plays a video of Media Card. It works very well and play the video properly on simulators. But when I loaded the app on the phone (BB Bold), it shows just a white screen and no video.

    The media file is in the following path on the map:

    / Media Card/BlackBerry/videos/I66.3GP

    The path should be:

    file:///SDCard/BlackBerry/videos/I66.3gp

    OR

    file:/// Card/BlackBerry/videos/I66.3GP Media

    Any suggestions on how to get it to work on the phone?

    class final VideoScreen extends form {}
    Private player player;
    private VideoControl vc;

    {VideoScreen()}
    try {}

    Reader = Manager.createPlayer ("file:///SDCard/BlackBerry/videos/I66.3GP");
    Player.Realize ();
    VC = player.getControl ("VideoControl") (alarm);
    vc.initDisplayMode (VideoControl.USE_DIRECT_VIDEO, this);
         
    GUIControl gc;
    If ((gc = player.getControl ("GUIControl")) (GUIControl)! = null)
    Add ((Field) gc.initDisplayMode (GUIControl.USE_GUI_PRIMITIVE, null));
    vc.setDisplayLocation (15, 15);
    vc.setDisplaySize (400, 400);
    vc.setVisible (true);
    Player.Start ();
      
    } catch (Exception e) {}
    }
    }

    Problem solved! It turns out that the "IoException: cannot access the media file" is because the BB is hooked up to the computer via USB, apprently Media Card is not available when USB is plugged.

    However, when USB is removed, I get this error:

    java.lang.IllegalArgumentException: arg must not be null and must be a javax.microedition.lcdui.Canvas

    It turns out that the audio/video tutorial of BB is incorrect, initDisplayMode cannot accept "GUIControl", he cannot accept that the canvas. In addition, if we directly on canvas without instantiate, it will be also caused an IllegalArgumentException.

    Then, the following code works:

    VideoControl vc;

    Canvas canvas = new MyCanvas ();

    If ((vc = player.getControl ("VideoControl")) (alarm)! = null) {}

    vc.initDisplayMode (VideoControl.USE_DIRECT_VIDEO, canvas);

    vc.setDisplayLocation (15, 15);

    vc.setDisplaySize (400, 400);

    vc.setVisible (true);

    Player.Start ();

    }

    While (MyCanvas) is a dummy class that extends from javax.microedition.lcdui.Canvas

    Import javax.microedition.lcdui.Canvas;

    import net.rim.device.api.ui.Graphics;

     

    MyCanvas class extends Canvas {}

    public

     

    public MyCanvas() {}

    }

     

    Protected Sub paint (javax.microedition.lcdui.Graphics arg0) {}

    / / TODO Auto-generated method stub

    }

    }

  • Event Swipe works in the Simulator, but not on the device

    I'm using panels on my 9900 and I have 4 panels that the user will slide back and forth similar functioning BB app world, changing the summary of comments on signs etc..

    My expection who was up and down for scanning of touch screen functions and the touchpad has the same function by default, that is to the left and right slide on the screen should also be identical to forehand and left on the block to tack. But it does nothing for the panels when you use the trackpad.

    So I replace NavigationMovement and and can see the touchscreen and the track pad to generate a NavigationMovement event with +/-x according to the direction slide. So I'm first puzzled why hit swiping the trackpad on the left and right triggers not the same behavior by hitting swiping left and right on the touch screen.

    Accept that as a limitation of the API, I added my own features to NavigationMovement to inject a key event when user left or right on the trackpad moves. As follows:

    EventInjector.TouchEvent [] moveEvents = new EventInjector.TouchEvent [7];

    moveEvents [0] = new EventInjector.TouchEvent (TouchEvent.MOVE, 420, -1, -1, 60-1);
    moveEvents [1] = new EventInjector.TouchEvent (TouchEvent.MOVE, 360, 60,-1, -1, -1);
    moveEvents [2] = new EventInjector.TouchEvent (TouchEvent.MOVE, 300, 60,-1, -1, -1);
    moveEvents [3] = new EventInjector.TouchEvent (TouchEvent.MOVE, 240, 60,-1, -1, -1);
    moveEvents [4] = new EventInjector.TouchEvent (TouchEvent.MOVE, 180, 60,-1, -1, -1);
    moveEvents [5] = new EventInjector.TouchEvent (TouchEvent.MOVE, 120, 60,-1, -1, -1);
    moveEvents [6] = new EventInjector.TouchEvent (TouchEvent.MOVE, 60, 60,-1, -1, -1);
    EventInjector.TouchEvent.injectSwipeGesture (480, 60, moveEvents);

    It works perfectly in the Simulator, but on the device, there is no movement at all. So I thought that maybe the touchpad on the Simulator is more sensitive than on the real device, so I added a menu item to perform the injection above. Again, this works perfectly on the Simulator, but nothing on the device.

    Has anyone tried this brain left and just before the injection?  Up and down the injection works perfectly on the device.

    Have you enabled event injection in request permission settings for your application?  It is disabled by default.  You can do so by going to Options-> Application, select your application and click on change permissions.  You can also request these permissions programmatically using the class ApplicationPermission.

  • App works on the Simulator, but not on the device

    Just try to run the helloworlddemo app compiles fine and works on the Simulator without problem. All I get on the device is an icon of the application that does nothing when clicked.

    I had read this might have to do with the version of the JDE is high for the operating system on the device, but I'm running JDE 6.0.0.37 and the operating system on the device is 6.0.0.666

    I tried with my own app first, compiled, signed it and get the same result as helloworld, then its certainly some mounted sort of question but I have no idea of what

    Thank you

    Sheldon

    Thought of it - was to set the permission of application so that all 3 items were "allow."

  • My App works on the Simulator, but not on a handheld

    Using the JDE 4.5 with 4.1.2 MDS Simulator

    Eclipse with JDE

    ---

    My app works fine on the simulator using MDS.

    The application simply pushes a screen and then creates a thread (an object of type LoadScreenThread) that will take an XML file using HTTP.  The XML file is parsed and then creates a new screen and it grows by calling (from LoadScreenThread): invokeLater with an executable object what method run() calls anti-pop and the specified UiApplication pushScreen.

    I tried various things for the last 10 hours and it still does not work.

    For the HTTP connection, because I would use MDS to Internet I added the '; '. deviceside = false' suffix.

    Could someone tell me please know why it would work fine on the Simulator (MDS) and not on a portable device?

    On the handheld, I see the arrows download flicker.  But it drives not only the new screen?

    Your device is connected to a MDS (BlackBerry Enterprise Server)?

    If it's just your BB private, so it's rather unlikely, and you will very probably connected to BIS. But you have to grant special permissions to RIM using BIS to use other means like the WAP2 gateway.

    Take a look at this thread:

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&thread.ID=29103

    It explains basically everything on the sides of the network connectivity to BlackBerry.

  • my world event working on the Simulator, but not on the device

    Hi guys,.

    I'm using BB bold 9000. I have attached directly to the device and debugging. I'm getting "background switch detected for myapp (261) that does NOT have the tunnels open - defocus is NOT called" on the device debugging. but it works fine on the Simulator (my ultimate task is slaughtering an application from another application) any idea?

    Thank you

    Thank you guys, it's worked.

  • Firefox does not open, but is rather the error message "Unable to read the configuration file." He has worked in the past, but not now.

    Firefox does not open, but is rather the error message "Unable to read the configuration file." He has worked in the past, but not now.

    I REINSTALL 10 TIMES SO DON'T TELL ME THAT!
    I'm piss because I need firefox work again, so I can finish my reseaching in 5 days.


  • Work of Auditors in the Simulator but not actually "BOLD"

    Hey - if anyone knows how to get a "BOLD" handset to allow listeners (PhoneListener, KeyListener, OutboundMessageListener) I would appreciate it. My app uses listeners and works very well in the Simulator, but only sporadically on the actual handset. Does anyone know how it works?

    See you soon,.

    Justin Dutoit

    I think you need to post a snippet of a listener of non-working, if you want to help more with this.

  • Can deploy app in the Simulator, but not to the device

    Sorry about this newbie question, but how is it that a simple HelloWorld application compiled in Eclipse runs just fine on the Simulator, but cannot be installed on a 8320 Curve by the Blackberry Desktop Software?

    I use the latest version at all.  The message returned by the desktop software is:

    ! There was an error importing files.
    No additional applications can be found. Your file can
    contain applications that already exist in the list of applications,
    are not compatible for your device, or errors.

    However, I am able to deploy the application on the handset using the command line tool:

    C:\Eclipse\plugins\net.rim.ejde\vmTools\JavaLoader.exe -usb load \workspace\HelloTest\deliverables\Standard\5.0.0\HelloTest.jad
    

    This installs the application, which then runs correctly on the device.  I can then reload the list of app on the Blackberry Desktop Software tool and it shows HelloTest, but under the properties of the Application-> dependencies it says:

    "Application not available (net_rim_cldc).

    It seems that some dependence crept in the generation of the application and that confuses the desktop tool.  The curve is running 4.5 OS.

    Should I just throw this office tool, or how can I clean the application so that it installs correctly?  Obviously, this is just foreplay before building a much broader application, and I wish I had these little glitches will hamper ASASP.

    Thanks for any help!

    You should be able to download a plugin 4.5 on the site to update. Go to "help > install new software" to open the screen of software available. If you have not yet done so, add the updated BlackBerry site to your Eclipse configuration:

    1. Click on "available software Sites.
    2. Click on the button 'Add '.
    3. Enter a name such as 'BlackBerry update location' and set the location http://www.blackberry.com/go/eclipseUpdate/3.5/java
    4. Click OK, then OK again to return to the screen of the software available

    The 'working with' menu drop-down, select the location of BlackBerry Update (or whatever you named it). Expand the BlackBerry Java plug-in category and you should be able to select an appropriate plug-in version.

  • image in SVG shows it on the Simulator, but not on the device

    Hi all

    I put theelement in an SVG file with an image that I pick up store or the SD card. I can see the image set on the Simulator, but am not able to see it on the device.

    Here is the code snippet I definition of the element in the image:

    SVGElement "newelement" = (SVGElement) _document.createElementNS (SVG_NAMESPACE_URI, "image");
    newElement.setTraitNS (XLINK_NAMESPACE_URI, "href", dittos);
    newElement.setFloatTrait ("x", 0);
    newElement.setFloatTrait ("y", 0);
    newElement.setFloatTrait ("width", Display.getWidth ());
    newElement.setFloatTrait ("height", Display.getHeight ());
    _svg. AppendChild (newelement);
    Invalidate();

    Thanks in advance.

    ~ Shri

    It was with the size of the Image. Too big a picture and the device wont set it to SVG canvas.

    If the scale down the image and set the image if you want to set asin SVG.

  • Train with webutil works with the browser, but not with webstart JNLP 12 c

    Hello

    I set up forms and reports suite 12 c according to the instructions and I'm testing my forms updated since version 10 g.

    In some forms, I use webutil.

    I can run forms without webutil with the browser or java web start (everything works fine).

    I have problems with the forms use webutil tha, they work very well with the browser, but not with java web start.

    When I run forms with webutil and webstart I see all white and the "crash" application: I must leave because other forms without webutil also do not work.

    Here is my config in formsweb.cfg:

    [Appws] <-start java web

    form = nomeform

    Archive = frmall.jar, frmicons.jar

    WebUtilArchive = jacob.jar, frmwebutil.jar

    WebUtilTrustInternal = true

    WebUtilLogging = off

    WebUtilLoggingDetail = normal

    WebUtilErrorMode = alert

    WebUtilDispatchMonitorInterval = 5

    WebUtilTrustInternal = true

    WebUtilMaxTransferSize = 16384

    baseHTML = webutilbase.htm

    baseHTMLjpi = webutiljpi.htm

    basejnlp = webutil.jnlp

    WebStart = on

    [appnows] <-no java web start

    shape = mercurio

    separateFrame = true

    Archive = frmall.jar, frmicons.jar

    WebUtilArchive = jacob.jar, frmwebutil.jar

    WebUtilTrustInternal = true

    WebUtilLogging = off

    WebUtilLoggingDetail = normal

    WebUtilErrorMode = alert

    WebUtilDispatchMonitorInterval = 5

    WebUtilTrustInternal = true

    WebUtilMaxTransferSize = 16384

    baseHTML = webutilbase.htm

    baseHTMLjpi = webutiljpi.htm

    basejnlp = webutil.jnlp

    What could be the problem?

    Gianpaolo

    Remove Appws:

    Archive = frmall.jar, frmicons.jar

    WebUtilArchive = jacob.jar, frmwebutil.jar

    baseHTML = webutilbase.htm

    baseHTMLjpi = webutiljpi.htm

    Add frmicons.jar and jacob.jar to $ORACLE_HOME/forms/java/extensions.jnlp.

    and try again.

    Concerning

  • Rental app run on the Simulator, but not in real device!

    Hello

    I made a simple application using GPSDemo in JDE, I get altitude, longitude, latitude... I tried in the Simulator (9000) and it worked perfectly.

    But when I put it on my BB (bold 9000), I can't get the location information. I've done some tests and I think it's because the location.isValid () return false!

    I checked the settings of the BB and the GPS is activated.

    Do you know what is the problem? And what can be the solution ?

    Thanks for your help and I apologize if my sentences are strange, I'm French and not very versed in English ^^...

    Ok! I found the solution! The problem wasn't my code, it came from the camera. I had update (outdoor) GPS data in the advanced options because it was the first time I tried to use it.

    And now it works perfectly!

    Thank you for all your help

  • database simple html5 works in the browser but not emulator

    I have a database of simple html5. It works on browser (chrome/safari) but not in the emulator. If after having included the html5_init.js file does not work on an os device five? I also simulated a sd card, so this isn't a problem, why it does not work. Here is the code:

    html PAG

    !DOCTYPE html PUBLIC-//W3C//DTD HTML 4.01 Transitional//Ehttp://www.w3.org/TR/html4/loose.dthtmheameta nameviewpor idMeta contentinitial-scale=1.0,user-scalable=n meta namex-blackberry-defaultHoverEffec contentfals link  relstyleshee typetext/cs hrefcss/common.cslink  link  relstyleshee typetext/cs hrefcss/start.cslink link  relstyleshee typetext/cs hrefcss/tabs.cslink
    titlAdd Birthda/titlscript typetext/javascrip srcjs/common.j/scripscript typetext/javascrip srcjs/html5_init.j idhtml5_ini/scripscript typetext/javascrip srcjs/birthdayapp.j/scrip
    /heabody onLoadinit()
           div classmy_heade
               p aligncenteAdd Birthda/
           /di
    
               div classmain-pane
                   div classpanel-top-lef/di
                   div classpanel-top-righ/di
                   div classpanel-insid
                    div classpanel-noga
                       div classro
                           div classlaeFirst Name/di
                           input typetex idfirstnam
                       /di
                       div classlistSeparato/di
                       div classro
                           div classlabeLast Name/di
                           input typetex idlastnam
                       /di
                       div classlistSeparato/di
                       div classro
                           div classlabeEmail/di
                           input typetex idemai
                       /di
    
                        div classlistSeparato/di
                       div classro
                           div classlabePhone Number/di
                           input typetex idphonenumbe
                       /di
                       div classlistSeparato/di
                        div classro
                           div classlabeImage/di
                           input typetex idimag
                       /di
                       div classlistSeparato/di
                        div classro
                           div classlabeBirthday/di
                           input typetex idbirthda
                       /di
                        div classlistSeparato/di
                        div classro
                           div classlabeBaught Gift/di
                           input typetex idbaughtgif
                       /di
                           div classlistSeparato/di
                        div classro
                           div classlabeReminder Day/di
                           input typetex idreminderda
                       /di
    
                    /di
                   /di
                   div classpanel-bottom-lef/di
                   div classpanel-bottom-righ/di
               /di
               input typebutto stylefloat: right; padding: 6px; margin-right: 8px idsav valueSav onClickmakeReminder()
    
            ul idreminder 
    
           /u 
    
            /bod/htm
    

    Now for the javascript database thread

    //Pre-requisites
    var birthdayapp = {};
    
    //Step 1. Opening the database
    birthdayapp.db = null;
    
    birthdayapp.open = function() {
      var dbSize = 5 * 1024 * 1024; // 5MB
      birthdayapp.db = openDatabase('bdreminder', '1.0', 'Birthday Reminder', dbSize);
    }
    
    birthdayapp.onError = function(tx, e) {
      alert('Something unexpected happened: ' + e.message );
    }
    
    birthdayapp.onSuccess = function(tx, r) {
      // re-render all the data
      // loadReminders is defined in Step 4a
      birthdayapp.getAllReminders(loadReminders);
      alert("an action was performed successfully!");
    }
    
    //Step 2. Creating the table
    birthdayapp.createTable = function() {
      birthdayapp.db.transaction(function(tx) {
        tx.executeSql('CREATE TABLE IF NOT EXISTS bdreminders(reminder_id INTEGER PRIMARY KEY ASC,'+
                                                            'firstname   varchar(50), '+
                                                            'lastname    varchar(50), '+
                                                            'email       varchar(50), '+
                                                            'phonenumber varchar(50), '+
                                                            'image       varchar(50), '+
                                                            'birthday    varchar(30), '+
                                                            'baughtgift  char(3),     '+
                                                            'reminderday varchar(50),'+
                                                            'createdon   date)', []);
      });
    }
    
    //Step 3. Adding data to the table
    birthdayapp.addReminder = function(firstname,lastname,email,phonenumber,image,birthday,baughtgift,reminderday) {
      birthdayapp.db.transaction(function(tx){
        var createdon = new Date();
        tx.executeSql('INSERT INTO bdreminders(firstname, lastname, email, phonenumber, image, birthday, baughtgift, reminderday, createdon) '+
                      'VALUES (?,?,?,?,?,?,?,?,?)', [firstname, lastname, email, phonenumber, image, birthday, baughtgift, reminderday, createdon],
            birthdayapp.onSuccess,
            birthdayapp.onError);
        });
    }
    
    //Step 4. Selecting data from the table
    birthdayapp.getAllReminders = function(renderFunc) {
      birthdayapp.db.transaction(function(tx) {
        tx.executeSql('SELECT * FROM bdreminders', [], renderFunc,
            birthdayapp.onError);
      });
    }
    
    //Step 4a. Rendering data from the table
    function loadReminders(tx, rs) {
      var rowOutput = "";
      for (var i=0; i < rs.rows.length; i++) {
        rowOutput += renderReminders(rs.rows.item(i));
      }
    
      var reminders = document.getElementById('reminders');
      reminders.innerHTML = rowOutput;
    }
    
    function renderReminders(row) {
      return '
  • ' + row.reminder_id + '[X]
  • '; } //Step 5. Deleting data from the table birthdayapp.deleteReminder = function(id) { birthdayapp.db.transaction(function(tx) { tx.executeSql('DELETE FROM bdreminders WHERE reminder_id=?', [id], birthdayapp.onSuccess, birthdayapp.onError); }); } //Step 6. update the table birthdayapp.updateReminder = function(reminder_id,firstname,lastname,email,phonenumber,image,birthday,baughtgift,reminderday) { birthdayapp.db.transaction(function(tx) { tx.executeSql('UPDATE bdreminders set firstname = ?, lastname = ?, email = ?,phonenumber = ?,image = ?,birthday = ?, baughtgift = ?, reminderday = ? WHERE reminder_id = "reminder_id" ', [firstname, lastname, email, phonenumber, image, birthday, baughtgift, reminderday], birthdayapp.onSuccess, birthdayapp.onError); }); } //Step 7. select a specific from table birthdayapp.getOneReminder = function(reminder_id) { birthdayapp.db.transaction(function(tx) { tx.executeSql('SELECT * FROM bdreminders WHERE reminder_id = ? ', [reminder_id], birthdayapp.onSuccess, birthdayapp.onError); }); } //select specific record function makeReminder(){ alert("add reminder called"); var fn = document.getElementById('firstname').value; var ln = document.getElementById('lastname').value; var em = document.getElementById('email').value; var ph = document.getElementById('phonenumber').value; var im = document.getElementById('image').value; var bd = document.getElementById('birthday').value; var bg = document.getElementById('baughtgift').value; var rd = document.getElementById('reminderday').value; birthdayapp.addReminder(fn,ln,em,ph,im,bd,bg,rd); } //init function function init() { birthdayapp.open(); birthdayapp.createTable(); birthdayapp.getAllReminders(loadReminders); }

  • The screen on the Simulator, but not on the device loads

    Hi all

    This issue is driving me crazy.

    The problem: I added a menu item in the email application. When the user clicks on the menu, I load a pop-up screen and get the entry user, then save it. This works quite well on my Simulator (8310 v4.5). But when I load in my camera (8310 v4.5), is not.

    I can't understand where is the problem. Your entries please.

    Note: I checked with the record menu item. I added a warning msg before loading of the screen. The alert is displayed, while the screen does not load. (The screen is a separate category in the same menuitem file, I have class instantiaite inside the application menuitem run() method).

    Sorry, I was in a hurry, so just wrote a very brief answer.  Unusual for me!

    Take a look at this:

    http://supportforums.BlackBerry.com/T5/Java-development/how-do-I-debug-on-a-live-device/Ta-p/446842

    There are other tips on the forum that you will probably find through research, should he not help.

  • Private opens in the Simulator, but not on the device

    Hello world

    I have a BlackBerry Tour 9630 (4.7.1.61). I'm running the 4.7.0 Simulator in Eclipse.

    Does anyone know why my application would open up a private in the Simulator without problem, but the browser does not open on my real device? I get no error on the device, it just goes to the next screen. I confirmed that the internet works on the device, and I don't see why use only the type of browser BIS would be a problem (I also tried BES).

    Here is my code:

    UiApplication.getUiApplication().invokeLater(new Runnable() {
        public void run() {
    
        BrowserSession session = BrowserLocator
            .createBrowserSession(BrowserLocator.BROWSER_TYPE_BIS);
                if (session != null) {
                    session.displayPage(loginUrl);
                }
    
        AuthorizeScreen authorizeScreen = new AuthorizeScreen();
        UiApplication.getUiApplication().pushScreen(authorizeScreen);
        UiApplication.getUiApplication().popScreen(OAuthScreen.this);
        }
    });
    

    Thank you!

    Thanks for your help.

    The session was to return null. I was able to reproduce this behavior in the simulator using a different type of browser not supported by the service books. Finally, I removed my own BrowserLocator() class (for the call of a certain browser) and replaced by the BrowserSessionFactory() provided in the JDE samples. I now have the browser on the opening device.

    What is the safest Bet, to use the default browser of the device, or use a browser BIS?

    Thank you!

Maybe you are looking for