GPS on Windows Phone 8.1 ? (solved)



  • I cannot make the GPS working on WindowsPhone 8.1 (Sensors are working)
    My code works well under Android but not under WP8.1.
    I'm using the latest Qt 5.4.0 - not clear if GPS is supported or not with WP8.1 ?

    Any idea how to access GPS with WP8.1 ?

    @
    QStringList services = QGeoPositionInfoSource::availableSources();
    source = QGeoPositionInfoSource::createDefaultSource(this);
    //source = QGeoPositionInfoSource::createSource(services.at(0), this); // services.at(0) = "winrt"

    if(source)
    {
        source->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods);
        source->setUpdateInterval(2000);
        connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
        source->startUpdates();
    }
    

    @

    [edit: added missing coding tags @ SGaist]


  • Lifetime Qt Champion

    Hi,

    AFAIK the plugin is there so it should be working. You should take a look at the "bug report system":http://bugreports.qt-project.org to see if there's something there about that



  • No need of any plugin.

    just add
    <Capabilities>
    <DeviceCapability Name="location"/>
    </Capabilities>
    right after </Applications> tag in AppxManifest.xml.
    and it works.

    So, like Android, WP81 needs permissions to access devices.


  • Lifetime Qt Champion

    The plugin is still needed (and present) otherwise you wouldn't get any data ;)



  • Youc an also specify the capabilities to be used inside the pro file, so that you do not need to manually update the Manifest each time. Check http://doc.qt.io/qt-5/qmake-variable-reference.html#winrt-manifest for more documentation.

    In that specific case add the following to your .pro file:

    WINRT_MANIFEST.capabilities_device = location


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.