10-07-2012 09:50 AM
Based on https://developer.blackberry.com/cascades/document
Here's 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::SatellitePositioningMethod s);
source->setUpdateInterval(1000);
source->setProperty("backgroundMode", true);
source->startUpdates();
}
}
Solved! Go to Solution.
10-16-2012 04:35 PM
By setting the preferred positioning methods to SatellitePositioningMethods you'll ideally need a clear view of the sky to get a position update. Did you try AllPositioningMethods? If you have a wifi connection you should get a position update within a few seconds and you can hopefully confirm that your slot is invoked.
Regards,
Jim
11-03-2012 05:19 AM
Have tried AllPositioningMethods, still not invoked
11-03-2012 09:18 AM
I am working on the same thing right now. I haven't got mine working yet. Did you set the correct permissions for the app and are Location Services turned on for your device?
11-03-2012 09:38 AM
Sure, gps location and location permission both allowed. Same result on Simulator
11-04-2012 11:18 PM - edited 11-04-2012 11:19 PM
Hi,
I am too working on GPS. I faced the same issue.
Did you try to fetch location using WiFi? I was able to fetch location using WiFi. It didn't work for other methods though.
Also I am not able to fetch updateTimeout() signal for the same.
http://supportforums.blackberry.com/t5/Cascades-De
Regards,
Nishant Shah
11-05-2012 07:38 AM
I got mine to work. This works for me.
m_positionInfoSource = QGeoPositionInfoSource::createDefaultSource(this); m_positionInfoSource->setUpdateInterval(1000); m_positionInfoSource->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods); if (m_positionInfoSource) { connect(m_positionInfoSource, SIGNAL(positionUpdated(const QGeoPositionInfo &)), this, SLOT(positionUpdated(const QGeoPositionInfo &))); connect(m_positionInfoSource, SIGNAL(updateTimeout()), this, SLOT(positionUpdateTimeout())); }
void GPSInfo::positionUpdated(const QGeoPositionInfo &pos)
{
11-05-2012 07:42 AM
does it work for all methods? & Is ever timeout signal emitted?
Regards,
Nishant Shah
11-05-2012 08:06 AM
It works for all methods. The timeout signal is only ever emitted if the requestUpdate method is called. It will never be emitted if the requestUpdates method is called.
11-05-2012 08:24 AM - edited 11-05-2012 08:24 AM
Okay. I did same as you wrote before in your previous reply. But its not working for me. Even the sample given by RIM (i.e. locationDiagnostics) is not working for methods other than WiFi on my device.
Also, I am facing same issue timeout signal is not emitted for startUpdates() method. Anyways thanx for replying.
Regards,
Nishant Shah