Interrupted exception in getting the location?

Hello..

My application is running in the background that gets the location by gps and cellsite... It shows me interrupted exception when I run the application... How can I start the two wires together? is there a way... How to handle this exception?

I added a while loop on it in the thread who sleep for 3 minutes and it works even if the condition is true for cellsite and it works when I run both when I run one of them...

but know not at the moment... I don't know the exception management as well... I just called wire cellsite except thread so gps location when gps does not provide the place or has expired at this time, it executes the cellsite thread... I do not know may be it can cause any problem after...

Tags: BlackBerry Developers

Similar Questions

  • Get the location of the device

    I had my application built with HTML5 for OS7, I build for BB10 and I decided to go with a feel more native and waterfalls. I must admit however, the old WebWorks documentation was much wasier and friendly, you had a small example of using each feature.

    I'm having a problem getting the location of the device, I went through the sample application "Diagnoses of the situation", but it's really complicated (he has 3 classes of objects with a ton of features to get the location).

    I'm just trying to find the location of the device, using cell towers, every two minutes. I want to create and the entire class for this? Also, how to trigger this function of the part of Cascades?

    I'd appreciate any help!

    Hello

    Here's a simplified example of code. These files are from the empty project template by default in the IDE of Momentix (file-> New-> project-> BlackBerry Project-> Application of stunts-> empty project Standard). They have been updated to include cellsite positioning updates every two minutes. The output will simply through cost.

    applicationui.h:

    // Default empty project template
    #ifndef ApplicationUI_HPP_
    #define ApplicationUI_HPP_
    
    #include 
    
    #include 
    
    using ::QtMobilitySubset::QGeoPositionInfo;     // so the SIGNAL()/SLOT() macros can have matching signatures.
    
    namespace bb { namespace cascades { class Application; }}
    
    /*!
     * @brief Application pane object
     *
     *Use this object to create and init app UI, to create context objects, to register the new meta types etc.
     */
    class ApplicationUI : public QObject
    {
        Q_OBJECT
    public:
        ApplicationUI(bb::cascades::Application *app);
        virtual ~ApplicationUI() {}
    
        void startCellSiteUpdates();
    
    public Q_SLOTS:
        void positionUpdated(const QGeoPositionInfo & pos);
        void positionUpdateTimeout();
    
    private:
        QtMobilitySubset::QGeoPositionInfoSource * _source;
    };
    
    #endif /* ApplicationUI_HPP_ */
    

    applicationui.cpp

    // Default empty project template
    #include "applicationui.hpp"
    
    #include 
    
    #include 
    #include 
    #include 
    
    #include 
    
    using namespace bb::cascades;
    
    ApplicationUI::ApplicationUI(bb::cascades::Application *app)
    : QObject(app)
    {
        // create scene document from main.qml asset
        // set parent to created document to ensure it exists for the whole application lifetime
        QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        // create root object for the UI
        AbstractPane *root = qml->createRootObject();
        // set created root object as a scene
        app->setScene(root);
    
        // Instantiate the default QGeoPositionInfoSource
        _source = QtMobilitySubset::QGeoPositionInfoSource::createDefaultSource(this);
        if ( _source ) {        // connect to the QGeoPositionInfoSource's signals, to get the position info and/or error status
            connect(_source, SIGNAL(positionUpdated(const QGeoPositionInfo &)), this, SLOT(positionUpdated(const QGeoPositionInfo &)));
            connect(_source, SIGNAL(updateTimeout()), this, SLOT(positionUpdateTimeout()));
        }
    }
    
    // call this method to start the position updates
    void ApplicationUI::startCellSiteUpdates()
    {
        if ( !_source ) {
    
            std::cout << "Error getting default position info source" << std::endl;
            return;
        }
    
        // QtLocation allows control over which provider(s) will be queried for position info. NonSatellitePositioningMethods
        // includes wifi and cellsite fix types.
        _source->setPreferredPositioningMethods( QtMobilitySubset::QGeoPositionInfoSource::NonSatellitePositioningMethods );
    
        // On BlackBerry the default QGeoPositionInfoSource allows finer control over the fix type. This extension, and others, take advantage of the Qt property system.
        // Here we are interested only in cellsite fixes.
        _source->setProperty("fixType", "cellsite");
    
        // set the update interval to a couple of minutes.
        _source->setUpdateInterval(120000);
    
        // start the updates, which we expect to receive in ApplicationUI::positionUpdated()
        _source->startUpdates();
    }
    // slot connected to the QGeoPositionInfoSource::positionUpdated() signal
    void ApplicationUI::positionUpdated(const QGeoPositionInfo & pos)
    {
        // print out the position in a convenient format:
        std::cout << pos.coordinate().toString().toLatin1().constData() << std::endl;
    
        // print out the accuracy as well, if available
        if ( pos.hasAttribute(QtMobilitySubset::QGeoPositionInfo::HorizontalAccuracy) ) {
            std::cout << "    horizontal accuracy = " << (double)pos.attribute(QtMobilitySubset::QGeoPositionInfo::HorizontalAccuracy) << std::endl;
        }
    
    }
    // slot connected to the QGeoPositionInfoSource::updateTimeout() signal
    void ApplicationUI::positionUpdateTimeout()
    {
        std::cout << "timeout occurred" << std::endl;
    
        // On BlackBerry more information as to why the device timed out may be available:
        bb::location::PositionErrorCode::Type errorCode = bb::location::PositionErrorCode::None;
    
        if ( _source->property("replyErrorCode").isValid()  ) {
            errorCode = _source->property("replyErrorCode").value();
            if ( errorCode != bb::location::PositionErrorCode::None ) {
                std::cout << "    " << _source->property("replyErrStr").toString().toLatin1().constData() << std::endl;
            }
        }
    }
    

    And main.cpp looks like this:

    // Default empty project template
    #include 
    
    #include 
    #include 
    #include "applicationui.hpp"
    
    // include JS Debugger / CS Profiler enabler
    // this feature is enabled by default in the debug build only
    #include 
    
    using namespace bb::cascades;
    
    Q_DECL_EXPORT int main(int argc, char **argv)
    {
        // this is where the server is started etc
        Application app(argc, argv);
    
        // localization support
        QTranslator translator;
        QString locale_string = QLocale().name();
        QString filename = QString( "SimpleLocation_%1" ).arg( locale_string );
        if (translator.load(filename, "app/native/qm")) {
            app.installTranslator( &translator );
        }
    
        ApplicationUI * appUI = new ApplicationUI(&app);
    
        appUI->startCellSiteUpdates();
    
        // we complete the transaction started in the app constructor and start the client event loop here
        return Application::exec();
        // when loop is exited the Application deletes the scene which deletes all its children (per qt rules for children)
    }
    

    Your file bar - descriptor.xml must contain this line to allow approval of the app for location-based services:

        access_location_services
    

    Also to ensure that location-based Services are enabled under settings on your device.

    Your .pro file should contain this line so that the QtLocationSubset library is linked:

    LIBS += -lQtLocationSubset
    

    I hope this helps!

    Jim

  • Get the location with the name of the city and the country.

    Hi, can someone explain the logic behind this?
    Once we get the coordinate of the location using the gps, how do we use to get the name of the city or the country?

    In addition, what is the difference between 'Place' and "Gps Position" in the authorization?

    0o0o

    Here you will find more specific information:
    https://developer.BlackBerry.com/Cascades/reference/qtmobilitysubset__qgeosearchmanager.html#functio...

  • get the location of the configuration file for each virtual in a cluster

    Is there way in the cli of power for a list of the location of each file in the configuration of the virtual machines in a cluster?  or even each file configuration on data warehouses?

    Thank you

    For all the virtual machines on the VIServer (s) connected

    Get - VM | Select Name, @{N = "VM Config file"; {E = {$_.extensiondata.config.files.vmpathname}}
    Or if you just want to a single data store
    Get-Datastore | Get - VM | Select Name, @{N = "VM Config file"; {E = {$_.extensiondata.config.files.vmpathname}}
    Replace with the data store you want to run it against, for example to run it against Datastore01
    Get-Datastore Datastore01 | Get - VM | Select Name, @{N = "VM Config file"; {E = {$_.extensiondata.config.files.vmpathname}}
  • exception in getting the blob into byte]

    HY guys,.
    I have a problem with my java application.
    I use hibernate to interact with a derby database.
    I've stored an image into the blob field (and not a problem).
    When I try to get the blob into byte array that I have this exception:
    java.sql.SQLException: You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling the free() method or after the Blob/Clob's transaction has been committed or rolled back.
    To get the BLOB I made
    Blob cThumnb = ((Allegato) cAllegati.get(i)).getThumb();
    byte[] cPrev = toByteArray(cThumnb);
    where
    private byte[] toByteArray(Blob fromBlob) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                return toByteArrayImpl(fromBlob, baos);
            }
            catch (SQLException e)
            {
                throw new RuntimeException(e);
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
            finally
            {
                if (baos != null)
                {
                    try
                    {
                        baos.close();
                    }
                    catch (IOException ex)
                    {
                    }
                }
            }
        }
    
        private byte[] toByteArrayImpl(Blob fromBlob, ByteArrayOutputStream baos)  throws SQLException, IOException
        {
            byte[] buf = new byte[4000];
            
            InputStream is = fromBlob.getBinaryStream();
            try
            {
                for (;;)
                {
                    int dataSize = is.read(buf);
                    if (dataSize == -1)     break;
                    baos.write(buf, 0, dataSize);
                }
            }
            catch(IOException ex)
            {
                    throw ex;
            }
            
           finally
            {
                if (is != null)
                {
                    try
                    {
                        is.close();
                    }
                    catch (IOException ex)
                    {
                    }
                }
            }
                    return  buf;// baos.toByteArray();
        }
    Could you help me?
    I define also autocommit to false.
    Thank you
    Concerning

    java.sql.SQLException: you can't call other methods of java.sql.Clob/java.sql.Blob after the free() method is called or after the transaction of the Blob/Clob object has been committed or rolled back.

    So invoke it before calling the free() method or until the transaction has been committed or canceled?

    And why the blob in an array of bytes to all? The idea of blobs is you don't know what size they are and how you treat the content as a stream.

  • Get the location of an annotation

    I am looking for the location coordinates / annotation and print.

    I can get the annotation and seem to even get contact information, but can not print them.

    That's what I'm looking for:

    Box ASFixedRect;

    PDAnnotGetRect (annot, & box);

    PTR = (char *) & box.left;

    sprintf (buf, "location of the annotation is %s", ptr ");

    AVAlertNote (buf);

    Thank you

    Tyler

    You must fill in the Member redactionProps.size the sizeof (PDRedactParams)

  • Where is the calendar Gets the location of the House?

    When I ask the calendar to calculate the travel times it suggests a calculated from the House at the location in the calendar entry. It is said this is home', but when I add something to a close location (5 minutes), he said 14 hours, 25 minutes. I can't understand where he thinks is "Home". I looked in my address book and my entry has a home address that is correct (even if it is a mailbox, but the city is correct)...

    Where he finds the House?

    He probably uses "location services" to determine your current location based on your IP address and Internet routing hops.  Because most computers do not have a real GPS radio (like iPhones), they use location services to best estimate based information available based on your Internet connection.  The problem is that location services based on Internet IPs are easily deceived by how your ISP will route your traffic to the Internet, or things like the use of VPN, TOR, or anonymity.  Depends on the method used for the exact location is.  In your case, it is to be tricked and guess wrong.

    I just found this site that can give you a confirmation of this: http://mylocation.org/

  • Get the location of BlackBerry Maps

    Hello

    In the BlackBerry map pinpoint me a location, for example New York. I want to save this place in my store.

    Can someone help me sort this

    Thanks in advance

    Jake

    You can add an ApplicationMenuItem to the card program. When you menu item is selected, the location (lat/lon) is sent to your application.

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800703/How_To _...

  • Get the location of the image within symbol

    I have a symbol with nested symbol.

    The nested symbol moves - and I can get his position like this:

    var mysym = sym.getSymbol("SymbolA").getSymbol ("NestedSymbol");

    Var top = Math.round (mysym.getSymbolElement () .position () .top);

    I also have an image inside a symbol that moves. The above does not work (I guess that getSymbol wouldn't work for an image).

    How can I get the position of a moving image within a symbol - in a manner similar to the foregoing.

    Thank you.

    The image will be set as a background to a div or element of the image

    Now, to read his use of the position

    Var top = Math.round (mysym.$('__').position () .top);

  • File adapter, how to get the location of the directory

    Hi '.

    I'm voting for the file from 3 different locations.

    C:\File\Location1
    C:\File\Location2
    C:\File\Location3

    Once the file is delivered in one of these directories
    the composite is able to start, I want to know inside the BPEL, which directory the file has been
    read, is there a function any or something that can tell me the location where the file are
    picked up...

    Please advice,

    Thank you
    Yatan

    Yatan,

    In the properties of the receive activity tab, you have an attribute named: jca.file.FileName
    In the value column, you can assign a variable that will contain the name of the directory.

    Arik

  • Where does get the location of the JRE of FF?

    I use Ubuntu Linux 12.04 and 20 of FireFox. The addons tab indicated that my java plugin had security problems and that he was currently blocked. Order of Mozilla was told to change the version of Java, I did. The former was 1.7.0.15 and the new 1.7.0.17 (aka 7u15 and 7u17 respectively). Being a programmer, I use the SDK and have my $JAVA_HOME the value of the JRE in the SDK. Then, I changed symlinks in usr and/usr/lib/firefox/plugins to point to the new version of libnpjp2.so in my updated JRE. Finally, I restarted FireFox... But the addons still show the old plugin!

    So where is Firefox search plugin? Is there a config file that I don't know?

    Thanks for the tip Jscher2000. I checked the full path and pointed out that the plugin is indeed from usr. Then of course, there was a problem with the plugin.

    Based on the links update provided by the Mozilla site, I downloaded the Java JRE lates separately in its own directory. Then, I put the symbolic link in usr to point to this version of the plugin... < path_to_jrelibnpjp2.so

    That fixed it.

    For the benefit of other Linux users: the Java SDK 1.7.0.17 for Linux contains the old version of libnpjp2.so (i.e. 1.7.0.15). God only knows why. Since this is a shared library, it should be OK to simply replace the file with one from the JRE download for version 1.7.0.17.

  • get the 8900 location

    Hello!

    I try to get edge location 8900 (os 4.6). What is the most appropriate time-out period to get the location?

    Please, share your experience in this field...

    It depends on what type of criteria you are using. A standalone solution may take 3 minutes or more.

    Did you read the documentation for reference on the use of GPS?

  • Cannot get the cell location is some devices?

    Hello

    I have problems with the location of the cell to get woithout GPS but the LocationProvider instance is always null.

    I use this criterion:

    ---------------------------------------------------

    Criteria = new Criteria();
    criteria.setHorizontalAccuracy (Criteria.NO_REQUIREMENT);
    criteria.setVerticalAccuracy (Criteria.NO_REQUIREMENT);
    criteria.setCostAllowed (true);
    criteria.setPreferredPowerConsumption (Criteria.POWER_USAGE_LOW);

    ---------------------------------------------------

    Get the location provider:

    ---------------------------------------------------

    LocationProvider locationProvider = LocationProvider.getInstance (criteria);

    ---------------------------------------------------

    is ALWAYS null.

    I check in a bold 9000 and a curve 8900and after seeing this page...

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800703/What_Is...

    ... I think it's impossible, isn't it?

    Otherwise, I have another solution that is to ask the id from cell to opencellid webservices, but it is very inaccurate.

    any idea?

    Thank you.

    Here is a link

    http://press.rim.com/release.jsp?id=2710

    The credit goes to Mark.

  • How to get the current location in the event thread?

    Hello!

    Can U pls tell me how to get the location where the thread object, it is in method() execution of MenuItem. PLS, tell me-

    I also used the different thread for the getLocation() method. But I do not have the coords of geo location...

    PLS, suggest me-

    My code is as below:

        private MenuItem getGeoCodes=new MenuItem("Current Coords",100,1){
    
                                 public void run(){
                                     double[] coords=getLocationCoords();
                                     this.wait(12000);
                                     System.out.println("Latitude :"+coords[0]+" "+"Longitude:"+coords[1]);
                                 }
    
                     };
    
        private double[] getLocationCoords(){
            Criteria criteria = new Criteria();
            criteria.setHorizontalAccuracy(500);
            criteria.setVerticalAccuracy(500);
            LocationProvider locationProvider = LocationProvider.getInstance(criteria);
            Location location=null;
            new Thread(){
               public void run(){
                       locationProvider.getLocation(60);
               }
            }
            QualifiedCoordinates qualifiedCoordinates=location.getQualifiedCoordinates();
            double[] coords=new double[]{qualifiedCoordinates.getLatitude(),qualifiedCoordinates.getLongitude()}   ;
             return coords;
        }
    

    But I myself NullPointerException. Coordinates get successfully, if we run the location capability in different function, rather than the event thread.

    Please help me-

    In my opinion, which may be too complicate things a bit. I think he's trying to do is register a LocationListener with his object of LocationProvider. Callback methods, send a message to the UI event thread as follows (no need to spawn threads):

    UiApplication.getUiApplication().invokeLater( new Runnable() {
        public void run()
        {
            // This code will execute on the event thread
        }
    });
    

    EDIT: If your interval is short, you can consider implementing this executable as a class and store an instance in the front.

  • Illegal state Exception when running the code at startup

    Here's my main method:

        public static void main(String[] args)
        {
            if (args.length == 1 && args[0].equals("startup"))
            {
                Criteria locationCriteria = new Criteria();
                locationCriteria.setCostAllowed(false);
                LocationProvider mlocationProvider;
                Location mLocation = null;
                try
                {
                    mlocationProvider = LocationProvider
                            .getInstance(locationCriteria);
                    mLocation = mlocationProvider.getLocation(-1);
                }
                catch (LocationException e) {
                }
                catch (InterruptedException e) {
                }
                QualifiedCoordinates mQC = mLocation.getQualifiedCoordinates();
            }
            else
            {
                MyApp theApp = new MyApp();
                theApp.enterEventDispatcher();
            }
        }
    

    The method

     mlocationProvider = LocationProvider.getInstance(locationCriteria); 
    

    throws the illegal state exception

    When I check the debug information, I found this exception are thrown to the line when he calls Application.getApplication ();

    When I move this code to run in a normal life to screen it works fine. !

    Any help?

    There may be a number of issues here:

    (1) until your Application is actually running, you can't really do any processing.  Your Application does not start running until you

    'enterEventDispatcher() '.

    Hand, all you should do is instantiate your Application.  Manufacturer of your Application should not do anything complicated either, since it works as part of main().

    You can do some activities, for example to add listeners, in main() code that is, in some respects, unfortunate because it lulls people into thinking they can do anything.  ,

    (2) get the location as you do, is a blocking call.  If you need to do it on a background Thread.  You c a get away with that on the Simulator because GPS simulated returns immediately with a location.  So it does not actually block.  But on a real device, code as you can force your application to break.

    (3) you seem to try to do something in the commissioning.  You must be aware, this start-up up is called as part of the start-up of the device and before the unit is fully active.  In fact, I think on a real device that this code will fail because the device is not ready to provide a location in the beginning upward.

    You will find find article, informative and useful for (1) and (3).

    http://supportforums.BlackBerry.com/T5/Java-development/write-safe-initialization-code/Ta-p/444795

    I suspect you want to start and get a location at first upward, in which case you might find this useful:

    http://supportforums.BlackBerry.com/T5/Java-development/create-a-background-application/Ta-p/445226

Maybe you are looking for

  • Questions of 'The double' in XP

    Hello I have a Dell Optiplex GX520, which has integrated audio.  The sound used to work great, until a recent reformat & reinstalling XP.  Now, the sound quality is very poor and will somehow slow the framerate of videos or any medium which is encode

  • Missing aero Vista theme

    I turned on my computer and the theme has been set to windows classic.  I tried everything to get back to aero, but it is nowhere. How can I get the theme back to aero?

  • BlackBerry Smartphones unable to connect to new ISP Mail

    Hi all I recently moved my e-mail from one ISP to another domain. I've updated my e-mail except for my Blackberry Pearl (Vodafone UK) client. On that note, I deleted the original mail account and went on the establishment of a 'new' but he always com

  • Authorization without authentication

    HelloFrom Java code, is it possible to query Weblogic LDAP users/groups without requiring a password?  I use an application Java with Weblogic 12.1.2 configured to point to an external LDAP server.  From a java client, I would use the Windows user na

  • Error message StorLib in the Lenovo Solution Center

    I get an error on the Device Manager tab in the center of solutions of Lenovo. He says drivers - "StorLib bus (support virtualstorage)", "Uninstall" State. I don't find anything anywhere on this unit or how to fix the problem. Any help out there? Not