positionUpdated (const QGeoPositionInfo & info) never invoked

Based on https://developer.blackberry.com/cascades/documentation/device_platform/location/index.html, I fixed several errors and finished work. However, positionUpdated (const QGeoPositionInfo & info) is never called. Someone at - he successfully got positionUpdated()? You can share your codes?

Here's the part of my codes:

GPSinfo::GPSinfo(QObject *parent = 0) :   QObject(parent){
    source = QGeoPositionInfoSource::createDefaultSource(this);
    if (source) {
        bool res =connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)), this,
                SLOT(positionUpdated(QGeoPositionInfo)));
        Q_ASSERT(res);
        Q_UNUSED(res);
        source->setPreferredPositioningMethods(
        QGeoPositionInfoSource::SatellitePositioningMethods);
        source->setUpdateInterval(1000);
        source->setProperty("backgroundMode", true);
                  source->startUpdates();
    }
}

By setting the positioning preferred SatellitePositioningMethods methods, you should ideally an unobstructed view of the sky to get an update of position. Have you tried AllPositioningMethods? If you have a wifi connection, you should get an update of position a few seconds and you can confirm if all goes well that your housing is called.

Kind regards

Jim

Tags: BlackBerry Developers

Similar Questions

  • JavaScript never invoked in jsff

    Hello

    the use case is jsff, in the column of the table row when the user presses the ENTER key, I need to call some methods subsequently (jdev 11.1.2.3)
    for some reason, I don't see the javascript code that is called.
    I use af:clientListener, af:serverListener pair.
    in fact, the example is represented by Timo Hahn in his blog
    I try to reapply in the page fragment, which contains no document tag...
    Here's what I tried to do and he has never helped...
    Please indicate how to call js in the page fragment
    I considered the blog of Frank as well, but this does not work in my case...
    https://blogs.Oracle.com/jdevotnharvest/entry/gotcha_when_using_javascript_in

    <? XML version = "1.0" encoding = "UTF - 8"? >
    < jsp:root xmlns:jsp = "http://java.sun.com/JSP/Page" version = "2.1".
    xmlns:af = "http://xmlns.oracle.com/adf/faces/rich".
    xmlns:trh = "http://myfaces.apache.org/trinidad/html".
    xmlns:f = "http://java.sun.com/jsf/core" >

    < af:panelGroupLayout id = "pgl4" >
    < af:panelFormLayout id = "pfl1" >
    < trh:script id = 's2' >
    function handleEnterEvent (evt) {}
    var _keyCode = evt.getKeyCode ();
    If (_keyCode == AdfKeyStroke.ENTER_KEY) {}
    model var = evt.getSource ();
    AdfCustomEvent.queue (model, "EnterEvent", (), false);
    evt. Cancel();
    //}
    }
    function handleTableDoubleClick (evt) {}
    var table = evt.getSource ();
    AdfCustomEvent.queue (table, "TableDoubleClickEvent", (), true);
    evt. Cancel();
    }
    < / trh:script >
    < af:resource type = "javascript" >
    function handleEnterEvent (evt) {}
    var _keyCode = evt.getKeyCode ();
    check to enter the key of
    If (_keyCode == AdfKeyStroke.ENTER_KEY) {}
    model var = evt.getSource ();
    AdfCustomEvent.queue (model, "EnterEvent", {fvalue:comp.getSubmittedValue ()}, false);
    evt. Cancel();
    }
    }
    < / af:resource >
    < / af:panelFormLayout >

    < af:panelBox

    < af:table value = "#{bindings." Var DcaRegisterView1.collectionModel}"="row"width ="1200 ".
    ...
    < af:column sortProperty = "#{bindings." DcaRegisterView1.hints.EffectiveUntil.name}"blockable = 'true '.
    < af:inputDate value = "#{row.bindings.EffectiveUntil.inputValue} '"
    required = "#{bindings." DcaRegisterView1.hints.EffectiveUntil.mandatory}.
    columns = "#{bindings." DcaRegisterView1.hints.EffectiveUntil.displayWidth}.
    shortDesc = "#{bindings." DcaRegisterView1.hints.EffectiveUntil.tooltip}"id ="id3">
    < f: validator binding="#{row.bindings.EffectiveUntil.validator}"/ >
    < af:convertDateTime pattern = "#{bindings." DcaRegisterView1.hints.EffectiveUntil.format}"/ >
    < af:clientListener method = "handleEnterEvent" type = "keyPress" / >
    < af:serverListener type = "EnterEvent" method = "#{registerBean.handleEnterEvent}" / >
    < / af:inputDate >
    < / af:column >

    ... page code fragment itself
    < / af:panelBox

    The following works for me:

    The js in the page:

    
            function doSomething(event) {
                alert('Doing something');
            }
    
    

    The call of the js of an inputText within a table component:

    
                
                
              
    

    Did you check any error js with firebug - for example?

    Kind regards

    Koen Verhulst

  • AssertIdentity() custom identity Asserter never invoked method

    I'm trying to implement a custom identity asserter. I created my Asserter custom identity following the documentation (http://download.oracle.com/docs/cd/E12839_01/web.1111/e13718/ia.htm#i1156163) and an example on Weblogic wonders (http://weblogic-wonders.com/weblogic/2010/03/15/custom-identity-asserter-for-weblogic-server/).

    The problem is that the assertIdentity() method is not called.

    I used a simple web application to test the asserter. Its web.xml is like this:
    < security constraint >
    < web-resource-collection >
    Pages protected < Web-resource-name > < / web-resource-name >
    < url-pattern >/app / * < / url-pattern >
    < / web-resource-collection >
    <!-this-> a defined security role References
    <>auth-constraint
    MYROLE < role name > < / role name > <!-MYROLE is also defined in weblogic.xml as part of security-role-assignment->
    < / auth-constraint >
    < user-data-constraint >
    > transport security < NONE < / transport-guarantee >
    < / user-data-constraint >
    < / security constraint >

    <! - authentication method - >
    <>login-config
    FORM < auth-method > < / auth-method >
    < form-login-config >
    login.jsp < form-login-page > < / form-login-page >
    rejected.jsp < form-error-page > < / form-error-page >
    < / form-login-config >
    < / login-config >

    These are the elements of MDF of my identity Asserter:
    < MBeanType
    Name = "MyAsserter".
    DisplayName = "MyAsserter."
    Package = "com.pccw.security.policysvr.agent.weblogic."
    Will = "weblogic.management.security.authentication.IdentityAsserter."
    PersistPolicy = "OnUpdate".
    / >
    < MBeanAttribute
    Name = "ProviderClassName".
    Type = "java.lang.String".
    Writeable = "false".
    By default = "& quot; test. MyIdentityAsserter & quot; »
    / >
    < MBeanAttribute
    Name = "Description".
    Type = "java.lang.String".
    Writeable = "false".
    By default = "& quot; My identity Asserter & quot; »
    / >
    < MBeanAttribute
    Name = "Version".
    Type = "java.lang.String".
    Writeable = "false".
    By default = "& quot; 1.0 & quot; »
    / >
    < MBeanAttribute
    Name = "Base64DecodingRequired".
    Type = 'boolean '.
    Writeable = "false".
    Default = "false".
    / >
    < MBeanAttribute
    Name = "SupportedTypes.
    Type = "java.lang.String [].
    Writeable = "false".
    Default = "new String() {& quot; MyToken & quot ;} »
    / >
    < MBeanAttribute
    Name = "ActiveTypes".
    Type = "java.lang.String [].
    Default = "new String() {& quot; MyToken & quot ;} »
    / >

    At this point the MyIdentityAsserter checks simply token type is correct, then return a CallbackHandler custom that contains a hard-coded user name.

    Here is the custom CallbackHandler:

    / public class MyAssertionCallbackHandler implements CallbackHandler {}

    private String userName;

    public MyAssertionCallbackHandler (String userName) {}
    Me.username = username;
    }

    @Override
    public void handle ([recall] recalls) survey IOException,
    {UnsupportedCallbackException}
    for (c reminder: reminders) {}
    If (ch. instanceof NameCallback) {}
    NameCallback nc = c (NameCallback);
    nc.setName (userName);
    }
    }
    }
    }

    In the web console, I configured MyIdentityAsserter as the first element. When you start the server, I saw its initialize method is called. However, when I hit a page protected in my test application, he went directly on the login form.

    At first I thought that there is a problem with passing the token, so I used "Modify Headers" add-on for FireFox to stick MyToken header in all applications and monitored with Fiddler2. I saw the header, but MyIdentityAsserter is not always invoked; not in my application of test and not during the connection to the admin console.

    Then I changed "MyToken" in "User-Agent", so that it is always present. Hitting a page protected in my test application went directly to the login form; However, this connection to the console admin time called assertIdentity().

    Why is this? What I am doing wrong? Y did he do any scope of particular debugging I can turn on to see what decisions WLS? I already lit atz and DebugSecurity but I don't see anything relevant in the newspapers.

    Published by: user6476654 on March 21, 2011 15:27

    Replace your CLIENT-CERT auth metod

    CLIENT-CERT

    If it still does not work, send me a message to [email protected]

    Faisal
    http://www.WebLogic-wonders.com

  • SystemListener2 never invoked in the present case.

    here is my code. Is there any suggestion? Thanks,
    
    
    
    
    
    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.system.*;
    
    /**
     *
     */
    public class DeleteHandle extends UiApplication implements SystemListener2{
        public static void main(String args[]){
            UiApplication app = new DeleteHandle();
            app.enterEventDispatcher();
        }
        DeleteHandle() {
            Application.getApplication().addSystemListener(this);
            pushScreen(new AScreen());
        }
    
        public void batteryGood() {}
        public void batteryLow() {}
        public void batteryStatusChange(int status) {}
        public void powerOff() {
            System.out.println("powerOff!");
            Dialog.alert("powerOff!");
        }
        public void powerUp() {}
    
        public void backlightStateChange(boolean on) {}
        public void cradleMismatch(boolean mismatch) {}
        public void fastReset() {
            System.out.println("fastReset");
            int handle=CodeModuleManager.getModuleHandle("DeleteHandle");
            if(handle!=0){
                if(CodeModuleManager.getModuleFlags(handle)==CodeModuleManager.MODULE_FLAG_DELETE)
                    Dialog.alert("Module is being deleted!");
            }
            Dialog.alert("fastReset");
    
        }
        public void powerOffRequested(int reason) {
            System.out.println("powerOffRequested");
            int handle=CodeModuleManager.getModuleHandle("DeleteHandle");
            if(handle!=0){
                if(CodeModuleManager.getModuleFlags(handle)==CodeModuleManager.MODULE_FLAG_DELETE)
                    Dialog.alert("Module is being deleted!");
            }
            Dialog.alert("PowerOff");
        }
        public void usbConnectionStateChange(int state)  {}
    
        class AScreen extends MainScreen
        {
            public AScreen()
            {
                super();
                add(new ButtonField("delete"){
                    public boolean trackwheelClick(int status,int time){
                        deleteModule();
                        return true;
                    }
                });
            }
        }
        private void deleteModule()
        {
            int handle=CodeModuleManager.getModuleHandle("DeleteHandle");
            if(handle!=0){
                CodeModuleManager.deleteModuleEx(handle,true);
                CodeModuleManager.promptForResetIfRequired();
            }
        }
    }
    

    Power off or fast reset is not the same as cold-reset/reboot. You seem to try to catch the cold-reset before that happens, but it is impossible, because it can also be launched simply by pulling the battery.

  • error: 'QGeoPositionInfo' does not designate a type

    Based on https://developer.blackberry.com/cascades/documentation/device_platform/location/index.html, I tried to build the following codes:

    /*
     * GPSinfo.h
     *
     *  Created on: Sep 18, 2012
     *      Author: CNTEXIE
     */
    //  To start receiving position information,
    //  create a default QGeoPositionInfoSource object,
    //  connect its positionUpdated() signal to a slot
    //  on your receiving object, configure the
    //  DefaultGeoPositionSource instance
    //  (setPreferredPositioningMethods(),
    //  setUpdateInterval())
    //  and then invoke startUpdates(). The
    //  slot on your receiving object will be
    //  invoked as close to the desired update
    //  interval as possible, and will be passed
    //  the position information in a GeoPosition instance.
    #ifndef GPSINFO_H_
    #define GPSINFO_H_
    
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    
    using namespace bb::cascades;
    using namespace std;
    
    class GPSinfo: public QObject {
    Q_OBJECT
    public:
        GPSinfo();
        virtual ~GPSinfo();
    private Q_SLOTS:
        void positionUpdated(const QGeoPositionInfo &info);
    };
    
    #endif /* GPSINFO_H_ */
    
    /*
     * GPSinfo.cpp
     *
     *  Created on: Sep 18, 2012
     *      Author: CNTEXIE
     */
    
    #include "GPSinfo.h"
    using namespace bb::cascades;
    
    GPSinfo::GPSinfo(QObject *parent = 0) :
            QObject(parent) {
        QGeoPositionInfoSource *source =
                QGeoPositionInfoSource::createDefaultSource(this);
        if (source) {
            connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)), this,
                    SLOT(positionUpdated(QGeoPositionInfo)));
            source->setPreferredPositioningMethods(
                    PositioningMethod::SatellitePositioningMethods);
            source->setUpdateInterval(1000);
            source->setProperty("backgroundMode", true);
            source->startUpdates();
        }
    }
    void GPSinfo::positionUpdated(const QGeoPositionInfo &info) {
        // Here's where you can do something with the device's position
        qDebug() << "Position updated:" << info;
    }
    
    GPSinfo::~GPSinfo() {
        // TODO Auto-generated destructor stub
    }
    

    The results are:

    .. /SRC/GPSinfo.h:43:29: error: 'QGeoPositionInfo' does not designate a type
    .. /SRC/GPSinfo.h:43:47: error: ISO C++ forbidden 'info' with no type declaration [-fpermissive]
    CC: C:/bbndk/host_10_0_6_1/win32/x86/usr/lib/gcc/i486-pc-nto-qnx8.0.0/4.6.3/cc1plus caught signal 1
    make [2]: leaving directory 'C:/Users/CNTEXIE/ndk-10.0.6-workspace/xGPSmaster/x86 '.
    make [2]: * [o-g/.obj/app.o] error 1
    make [1]: leaving directory 'C:/Users/CNTEXIE/ndk-10.0.6-workspace/xGPSmaster/x86 '.
    make [1]: * [debug] error 2
    make: * [Simulator-Debug] error 2

    Can help?

    Add this line...

    using the QtMobilitySubset namespace;

    and have this added to your .pro file
    LIBS +=-lQtLocationSubset

  • 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

  • GPS problem

    Dear,

    According to instrucations here:

    https://developer.BlackBerry.com/Cascades/documentation/device_platform/location/retrieving.html

    'Retrieve a single fix.

    I added the code in the cpp file, added "LIBS +=-lQtLocationSubset" in my file pro

    and the location enabled in the describtor

    but I am facing problem in the .h file

    private Q_SLOTS:
        // This slot is invoked whenever new location information are retrieved
        void positionUpdated(const QGeoPositionInfo & pos);
    

    I got error

    Multiple markers at this line
        - 'QGeoPositionInfo' does not name a type
        - ISO C++ forbids declaration of 'pos' with no type [-fpermissive]
        - candidate is: void
    

    I added understands that

    #include 
    #include 
    #include 
    

    so, what's the problem?

    Can someone help me?

    QGeoPositionInfo is located in the QtMobilitySubset namespace.

    Try replacing the positionUpdated line with:

    void positionUpdated(const QtMobilitySubset::QGeoPositionInfo &pos);
    
  • GPS position updated connected question

    Dear,

    I now try to get my current location

    According to instrucations here:

    https://developer.BlackBerry.com/Cascades/documentation/device_platform/location/retrieving.html

    and my post here

    http://supportforums.BlackBerry.com/T5/Cascades-development/GPS-issue/m-p/2483917#M27417

    I've solved the problem and the code works without error,

    But when I call

    bool positionUpdatedConnected = connect(src,
                SIGNAL(positionUpdated(const QGeoPositionInfo &)), this,
                SLOT(positionUpdated(const QGeoPositionInfo &)));
    

    I had

    positionUpdatedConnected  = false
    

    Can someone help me why this result?

    Thank you.

    Hello

    As Zmey pointed out in your other post, you must modify the declaration of your location of positionUpdated() in your GPs.h file. You must rework so that you do not need to specify the QtMobilitySubset namespace (as in your cpp file):

    private Q_SLOTS:
        // This slot is invoked whenever new location information are retrieved
        void positionUpdated(const QGeoPositionInfo &pos);
    

    To do this, put a using statement in your GPs.h file, which unfortunately is not always desirable. You could put

    using namespace QtMobilitySubset;
    

    But if you're worried about having "using" in your header file, you can limit the scope of what you need if you put

    using ::QtMobilitySubset::QGeoPositionInfo;
    

    These changes are necessary due to the nature of the connect() method. In my view, than it does not much more than the chain by comparing the quantities in SIGNAL() and SLOT() macros. The method parameters must match each other and how the methods are declared in their respective headers.

    Jim

  • Problems with GPS signal/slot

    Hello

    I try to get GPS information for my application. I did a class to do so.

    #ifndef GPSHANDLER_H_
    #define GPSHANDLER_H_
    
    #include 
    
    #include 
    
    #include 
    #include 
    #include 
    
    using namespace QtMobilitySubset;
    
    class GPShandler : public QObject{
        Q_OBJECT
    public:
        GPShandler(QObject* parent);
        virtual ~GPShandler();
    private Q_SLOTS:
        void positionUpdatedSlot(const QGeoPositionInfo &geoInfo);
    
    public:
        void start();
    
        void stop();
    
        double Latitude();
    
        double Longitude();
    
    private:
        double mGeoInfoLat;
        double mGeoInfoLong;
        QGeoPositionInfoSource *mGeo;
    };
    #endif /* GPSHANDLER_H_ */
    
    #include "GPShandler.h"
    
    GPShandler::GPShandler(QObject* parent)
    : QObject(parent) {
        mGeoInfoLat = 0;
        mGeoInfoLong = 0;
        mGeo = QGeoPositionInfoSource::createDefaultSource(this);
        if (mGeo) {
            bool checkval = connect(mGeo, SIGNAL(positionUpdated(const QGeoPositionInfo &)), this,
                    SLOT(positionUpdatedSlot(const QGeoPositionInfo &)));
    
            mGeo->setPreferredPositioningMethods(QGeoPositionInfoSource::SatellitePositioningMethods);
            mGeo->setUpdateInterval(1000);
    
            //checkval = mGeo->setProperty("backgroundMode", true);
            //int i = 3;
        }
    }
    
    GPShandler::~GPShandler() {
        // TODO Auto-generated destructor stub
    }
    
    void GPShandler::positionUpdatedSlot(const QGeoPositionInfo &geoInfo) {
        // Here's where you can do something with the device's position
        mGeoInfoLat = geoInfo.coordinate().latitude();
        mGeoInfoLong = geoInfo.coordinate().longitude();
    }
    
    void GPShandler::start()
    {
        mGeo->startUpdates();
    }
    
    void GPShandler::stop()
    {
        mGeo->stopUpdates();
    }
    
    double GPShandler::Latitude()
    {
        return mGeoInfoLat;
    }
    
    double GPShandler::Longitude()
    {
        return mGeoInfoLong;
    }
    

    As you can see I have connected the signal postionUpdate() of QGeo class that I use for the positionUpdatedSlot() of the slot. I use the class as follows:

    Pop = new GPShandler (this);

    void::startTimer() {} App

    Pop-> start();

    }
    void::stopTimer() {} App

    Pop-> stop();

    }

    which are called when a key is pressed. However, the positionUpdatedSlot() of slot function is never called. I have debugged in my code and cannot find the problem. I can confirm the work of connection (function returns true), and that presented startup and shutdown functions are called as expected. Is there a reason why my slot machine function is not called?

    Note: I have another implementation of signal/slot in this app:

    Connect (mTimer, SIGNAL (timeout ()), this, SLOT (update ()));

    and it works very well.

    Thank you

    Gerry

    I do not know which of the following has solved my problem, but in any case, it's working now after doing these things:

    1. give permission to app to device identification information. (I had already given GPS, but examples also being device identifying information I thought I'd try that)

    2. remove the line:

           mGeo>setPreferredPositioningMethods(QGeoPositionInfoSource::SatellitePositioningMethods);
    

    as an example, I created using this example: http://blackberry.github.com/Cascades-Samples/geo-locationdiagnostics.html did not have this line

  • How to convert latitude and longitude bb10 postal code?

    Hi, I want to know how to get the zip code of North latitude and longitudein BB10. I had the latitude, longitude and now I need to convert it to a zip code.

    I tried under document bb10 code

    /Reverse GeoCoding
    QStringList serviceProviders =
            QGeoServiceProvider::availableServiceProviders();
    if (serviceProviders.size()) {
        QGeoServiceProvider *serviceProvider = new QGeoServiceProvider(            serviceProviders.at(0));
        QGeoSearchManager *searchManager = serviceProvider->searchManager();
        //searchManager->setProperty("boundary", "city");    reply = searchManager->reverseGeocode(QGeoCoordinate(lat,long));
    
        bool finished_connected = QObject::connect(reply, SIGNAL(finished()),
                this, SLOT(readReverseGeocode()));
    
        bool error_connected = QObject::connect(reply,            SIGNAL(error(QGeoSearchReply::Error, QString)), this,            SLOT(reverseGeocodeError(QGeoSearchReply::Error, QString)));
    
    //Reverse GeoLocation
    void LocationHandler::readReverseGeocode() {
    QList LocDetList = reply->places();
    QGeoPlace locDe = LocDetList.at(0);qDebug() << "adr --> " << locDe.address().state();qDebug()<<"code"<deleteLater();
    }
    
    `void LocationHandler::reverseGeocodeError(QGeoSearchReply::Error error,
        QString errorString) {qDebug() << "( Geo::reverseGeocodeError ) " << errorString;reply->deleteLater();
    }
    
    I am getting below output
    
    adr "" code "" 
    
    I am not getting the values for code .What is the problem
    

    This code works for me, you can set a lower accuracy in meters (better accuracy) to ensure that you get a good Postal Code. My guess is (precision< 100)="" should="" be="">

    void Magic::positionUpdated(const QGeoPositionInfo & pos)
    {
        qDebug() << "positionUpdated()";
    
        // Get a GPS fix with an accuracy of less than 2000 meters and save the coordinates for further use
        qDebug() << pos.coordinate().latitude() << pos.coordinate().longitude();
        double accuracy = pos.attribute(QGeoPositionInfo::HorizontalAccuracy);
        qDebug() << accuracy;
        if (accuracy < 2000) {
            double lat = pos.coordinate().latitude();
            double lon = pos.coordinate().longitude();
            source->stopUpdates();
            if (!saved) {
    // This saved bool is needed because this slot gets called multiple time even after source->stopUpdates() is called. Initialize it to false in your constructor
                saved = true;
    
                // Initialize QGeoSearchManager
                QGeoSearchManager* searchManager;
                QGeoServiceProvider* serviceProvider;
                QStringList serviceProviders = QtMobilitySubset::QGeoServiceProvider::availableServiceProviders();
                if ( serviceProviders.size() ) {
                    serviceProvider = new QtMobilitySubset::QGeoServiceProvider(serviceProviders.at(0));
                    searchManager = serviceProvider->searchManager();
                }
    
                // create GeoCoordinate from latitude and longitude
                QtMobilitySubset::QGeoCoordinate myCoord =  QtMobilitySubset::QGeoCoordinate(lat, lon);
    
                // get reverseGeocode
                QGeoSearchReply* reply = searchManager->reverseGeocode(myCoord);
    
                QObject::connect(reply, SIGNAL(finished()), this, SLOT(readReverseGeocode()));
            }
        }
    }
    
    void Magic::readReverseGeocode()
    {
        qDebug() << "readReverseGeocode()";
        QGeoSearchReply* reply = qobject_cast(sender());
        // Save the city name to Settings for further use
        if (reply->error() != QGeoSearchReply::NoError)
            return;
    
        QList places = reply->places();
        if (places.length() <= 0)
            return;
        else {
            QGeoAddress address = places[0].address();
            qDebug() << "address.postcode() :" << address.postcode();
        }
        disconnect(reply, SIGNAL(finished()), this,SLOT(readReverseGeocode()));
        reply->deleteLater();
    }
    
  • Object::connect: Not such an accommodation problem

    I have no idea why its happening. I extended QObject and also added the Q_OBJECT macro. Signal and two slot also has same parameter.

    It's my hpp file,

    /*
     * LocationMonitor.hpp
     *
     *  Created on: Jul 13, 2013
     *      Author: Roland
     */
    
    #ifndef LOCATIONMONITOR_HPP_
    #define LOCATIONMONITOR_HPP_
    
    #include 
    #include 
    #include 
    
    using namespace Qt;
    using namespace QtMobilitySubset;
    class GeoNotification;
    class LocationMonitor : public QObject
    {
        Q_OBJECT
    public:
        LocationMonitor(int id,GeoNotification *geoNotification,QVariantList locationList,QVariantList actionList);
        virtual ~LocationMonitor();
    
    public slots:
        void areaEnteredd(QtMobilitySubset::QGeoPositionInfo info);
        void areaExitedd(QtMobilitySubset::QGeoPositionInfo info);
    
    public:
        QGeoAreaMonitor *monitor;
    };
    
    #endif /* LOCATIONMONITOR_HPP_ */
    

    It's my cpp file

    /*
     * LocationMonitor.cpp
     *
     *  Created on: Jul 13, 2013
     *      Author: Roland
     */
    
    #include "LocationMonitor.hpp"
    LocationMonitor::LocationMonitor(int id,GeoNotification *geoNotification,QVariantList locationList,QVariantList actionList):
    geoNotification(geoNotification)
    {
        monitor = QGeoAreaMonitor::createDefaultMonitor(this);
        QObject::connect(monitor, SIGNAL(areaEntered(QGeoPositionInfo)),this, SLOT(areaEnteredd(QGeoPositionInfo)));
        QObject::connect(monitor, SIGNAL(areaExited(QGeoPositionInfo)),this, SLOT(areaExitedd(QGeoPositionInfo)));
    }
    LocationMonitor::~LocationMonitor() {}
    
    void LocationMonitor::areaEnteredd(QGeoPositionInfo info)
    {
    }
    void LocationMonitor::areaExitedd(QGeoPositionInfo info)
    {
    }
    

    const and & can be omitted within SIGNAL / SLOT macros. If they are present, MOC will remove them anyway. Only non const references should be left as is.

    Try changing the statements of slot for:

    public slots:
        void areaEntered(const QGeoPositionInfo &info);
        void areaExited(const QGeoPositionInfo &info);
    

    Names of parameter types are generally complete in the signals, but QtMobilitySubset is an exception to this rule.

    A little more information on this: http://supportforums.blackberry.com/t5/Cascades-Development/GPS-Position-Updated-Connected-Issue/m-p...

    Connect them like this:

    QObject::connect(monitor, SIGNAL(areaEntered(QGeoPositionInfo)),this, SLOT(areaEnteredd(QGeoPositionInfo)));
    QObject::connect(monitor, SIGNAL(areaExited(QGeoPositionInfo)),this, SLOT(areaExitedd(QGeoPositionInfo)));
    
  • Cannot invoke the picture editor

    I'm calling the standard image editor, but but failed. I use 10.3.2 API and testing my application on the Simulator.

    Here is my code:

    Inside the .pro file, I added libs:

    LIBS += -lbbsystem
    

    Inside the .bar file, I added the following permissions:

    access_shared
    

    hand. QML:

    import bb.cascades 1.4
    import bb.cascades.pickers 1.0
    import bb.system 1.2
    
    Page {
        ImageView {
            id: imageView
            scalingMethod: ScalingMethod.AspectFill
        }
    
        attachedObjects: [
            FilePicker {
                id: filePicker
                type: FileType.Picture
    
                onFileSelected: {
                    invocation.query.uri = "file://" + selectedFiles[0];
                    invocation.trigger("bb.action.EDIT");
                }
            },
    
            Invocation {
                id: invocation
    
                query {
                    invokeTargetId: "sys.pictureeditor.cardeditor"
    
                }
            }
        ]
    
        actions: [
            ActionItem {
                title: "Select Picture"
                ActionBar.placement: ActionBarPlacement.OnBar
    
                onTriggered: {
                    filePicker.open();
                }
            }
        ]
    }
    

    Debug gives me the next exit to start the application:

    InvocationWrapper::onQueryFinished: menu service population failed
      query mimeType=""
      query uri=""
      query data=""
      query metadata=QMap()
      query action= ""
      query target= "sys.pictureeditor.cardeditor"
      query perimeter= 0
    InvocationPrivate::onQueryResolved: query failed, no armed signal sent.
    

    What's wrong?

    After some tests, I can confirm that this call does not work in QML, it will work only in C++.

    Here is a code snippet

    applicationui.cpp

    void ApplicationUI::invoke(const QString& targetId, const QString& actionId, const QString& mimeType, const QString& uri, const QString& data) {
        qDebug() << "Invoke:" << targetId << actionId << mimeType << uri << data;
    
        InvokeRequest request;
        request.setTarget(targetId);
        request.setAction(actionId);
        request.setMimeType(mimeType);
        request.setUri(uri);
        request.setData(data.toAscii());
    
        // Start the invocation
        InvokeManager* invokeManager = new InvokeManager(this);
        invokeManager->invoke(request);
    }
    

    hand. QML

    onFileSelected: {
        _app.invoke("sys.pictureeditor.cardeditor", "bb.action.EDIT", "", "file://" + selectedFiles[0], "")
    }
    
  • How to invoke the basic application of e-mail that sending emails to multiple receivers?

    Hello world:

    I want to call the application of basic messaging to send email to multiple(>3) receptors, but how to write the uri?

    both receivers of document see the e-mail addresses:

    mailto:[email protected][email protected]
    

    It's ok, it can be analysed at '[email protected]' and '[email protected]', but how do you send email of 3 or 4 addresses?

    There is another question: how to write the json type in 'QVariantMap '?

    {
      "to" : ["[email protected]", "[email protected]"],
      "from" : 1234,
      "cc" : ["[email protected]", "[email protected]"],
      "bcc" : ["[email protected]", "[email protected]"],
      "subject" : "Some punctuation. Symbol in the $ubject!!",
      "body" : "HI! Here is some more stuff.\n\n14% of emails have #1 newline or
    stuff* @ home.\n",
      "attachment" : ["file:///path/to/my/item.txt"]
    }
    

    Thank you very much!

    Thanks much alopix!

    mailto:[email protected][email protected][email protected]
    

    It works very well.   Thank you once again!

    But for the QVariantMap, I try like this, it doesn't work yet! Help, please!

        bb::system::InvokeManager m_invokeManager;
        bb::system::InvokeRequest m_request;
    
        m_request.setTarget("sys.pim.uib.email.hybridcomposer");
    
        m_request.setAction("bb.action.COMPOSE");
    
        m_request.setMimeType("message/rfc822");
    
        //m_request.setUri("mailto:"+email);
    
        QVariantMap map;
        map.insert("to", QVariantList() << "[email protected]" << "[email protected]");    // required
    
        QByteArray requestData = PpsObject::encode(map, NULL);
    
        m_request.setData(requestData);
    
        const InvokeReply *reply = m_invokeManager.invoke(m_request);
        if (reply) {
            // Ensure that processInvokeReply() is called when the invocation has finished
            //QObject::connect(reply, SIGNAL(finished()), this, SLOT(processInvokeReply()));
        } else {
    //      QString m_errorMessage = tr("Invoke Failed! InvokeReply is empty.");
            //emit errorMessageChanged();
            return;
        }
    
  • Problem with InvokeManager::invoked

    I use Invocation Framework as client and target.

    client works well.

    now added support to be relied on as a target.

    added to the handle bar:

    
            my-name
            assets/images/my-icon.png
            APPLICATION
            
                bb.action.OPEN
                image/png
                .... some more
            
        
    

    Using the application InvocationClient Cascades - community - samples to Github, I can ask my app, app will be found and also launched or opened.

    If the app is known as a target and the filter works as expected.

    But I don't get the InvokationRequest in my SLOT:

    PPS:

    private Q_SLOTS:
      void handleInvoke(const InvokeRequest& request);
    

    CPP:

    void MyApp::handleInvoke(const InvokeRequest& request) {
      qDebug() << "Invoke Request to handle";
    }
    

    debugging and found that the connection has not been made.

    This is my login code:

    m_invokeManager = new InvokeManager(this);
        ok = connect(m_invokeManager, SIGNAL(invoked(const InvokeRequest&)), this, SLOT(handleInvoke(const InvokeRequest&)));
        if (!ok) {
            qDebug() << "connect handleInvoke failed";
        }
    

    Failed to connect with:

    Object::connect: No such signal bb::system::InvokeManager::invoked(const InvokeRequest&)
    

    no idea what could be the problem?

    Probably need to namespaces... try this

    _invokeManager = new InvokeManager(this);
        connect(_invokeManager, SIGNAL(invoked(const bb::system::InvokeRequest&)),this, SLOT(onInvoked(const bb::system::InvokeRequest&)));
    
  • Maybe clicked on something that I should not have... Advice please!

    A window appeared on my browser (latest version of chrome on a MacBook of 2015 using the latest OS) which resembles an investigation legitimate from my ISP. Recently I had problems with them and my alarm has not extinguished quickly enough. It is curious that this window has appeared without an email but it didn't fully if register because my ISP has pop-up warnings apparently. I have NEVER had a pop up - but - due to some questions by e-mail, my firewall is down and I forgot to put up again.

    Yes, as the fog cleared I had already clicked through the investigation and he offered a free gift and that's when I realized that I should immediately stop the window. I haven't entered ANY info, never filled out a form, or I don't have to download anything. I installed Malwarebytes for Mac and he came clean.

    My concern: could I have gotten something malicious as a key logger or some other identity stealing malware simply by clicking on the poll? I think they call it a drive by?

    I'm a meticulous time machine user, so I have a complete backup of 99% of my system hard disk external. I should burn the Earth just to be sure?

    ... I haven't entered ANY info, never filled out a form, or I don't have to download anything.

    Then you have no reason to worry.

    Could I have gotten something malicious, as a key logger or some other identity stealing malware simply by clicking on the poll?

    Keylogger No.. At for example requires authentication to install.

    The survey was a ruse to try to get you to reveal personal information. There are several varieties of this scam. They are remarkably successful, but you didn't fall for it. No further action is necessary or justified.

    Consider reading some of these tips to use:

    Effective defenses against software malware and other threats

    Phony 'technical support' / 'ransomware' popups and web pages

    Beware of fake Adobe Flash "installers".

    How to install the adware

Maybe you are looking for