Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Regular Contributor
xhotkey
Posts: 53
Registered: ‎09-19-2012
My Device: 9700
Accepted Solution

positionUpdated(const QGeoPositionInfo &info) never invoked

Based on https://developer.blackberry.com/cascades/documentation/device_platform/location/index.html, I fixed several errors and finally got it running. However, positionUpdated(const QGeoPositionInfo &info) is never invoked. Has anyone sucessfully got positionUpdated()? Can you share your codes?

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::SatellitePositioningMethods);
		source->setUpdateInterval(1000);
 		source->setProperty("backgroundMode", true);
                  source->startUpdates();
	}
}

 

BlackBerry Development Advisor
jehrismann
Posts: 68
Registered: ‎10-15-2012
My Device: Z10

Re: positionUpdated(const QGeoPositionInfo &info) never invoked

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

Regular Contributor
xhotkey
Posts: 53
Registered: ‎09-19-2012
My Device: 9700

Re: positionUpdated(const QGeoPositionInfo &info) never invoked

Have tried AllPositioningMethods, still not invoked

 

Developer
Bluenoser
Posts: 309
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: positionUpdated(const QGeoPositionInfo &info) never invoked

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?

Regular Contributor
xhotkey
Posts: 53
Registered: ‎09-19-2012
My Device: 9700

Re: positionUpdated(const QGeoPositionInfo &info) never invoked

Sure, gps location and location permission both allowed. Same result on  Simulator 

Regular Contributor
_NishantShah
Posts: 76
Registered: ‎07-31-2012
My Device: Blackberry

Re: positionUpdated(const QGeoPositionInfo &info) never invoked

[ Edited ]

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-Development/Can-not-fetch-updateTimeout-signal/m-p/1...

Regards,
Nishant Shah

Developer
Bluenoser
Posts: 309
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: positionUpdated(const QGeoPositionInfo &info) never invoked

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)
{

 

Regular Contributor
_NishantShah
Posts: 76
Registered: ‎07-31-2012
My Device: Blackberry

Re: positionUpdated(const QGeoPositionInfo &info) never invoked

does it work for all methods? & Is ever timeout signal emitted?

Regards,

Nishant Shah

Developer
Bluenoser
Posts: 309
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: positionUpdated(const QGeoPositionInfo &info) never invoked

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.

Regular Contributor
_NishantShah
Posts: 76
Registered: ‎07-31-2012
My Device: Blackberry

Re: positionUpdated(const QGeoPositionInfo &info) never invoked

[ Edited ]

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