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
Developer
Posts: 18
Registered: ‎04-09-2013
My Device: Z10
My Carrier: Vodafone

Not getting location update from QGeoPositionInfoSource.

Hi All,

i used following code for getting my device location but i am not getting any location update from QGeoPositionInfoSource.I updated my bar file location services and internet.

 

Code:

void GettingLocationofdevice::getLocation()
{
  QGeoPositionInfoSource *src=QGeoPositionInfoSource::createDefaultSource(this);
  src->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods);
  bool positionUpdationConnection =connect(src, SIGNAL(positionUpdated(const QGeoPositionInfo &)),this,SLOT(positionUpdated(const QGeoPositionInfo &)));
  if (positionUpdationConnection) {
     qDebug()<<"Location updation Request sending";
     src->requestUpdate();
     //src->startUpdates();
  } else {

  }
}

void GettingLocationofdevice:Smiley TongueositionUpdated(const QGeoPositionInfo &position)

{
    qDebug()<<"got location Printing " ;
   QGeoCoordinate coordinate=position.coordinate();
   double latitude =coordinate.latitude();
   double longitude =coordinate.longitude();
   qDebug()<<"latitude:"<<latitude<<"longitude"<<longitude;

}

 

Any help, will be thankful.

Retired
Posts: 54
Registered: ‎06-26-2012
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Not getting location update from QGeoPositionInfoSource.

which os and ndk are you using?

Developer
Posts: 18
Registered: ‎04-09-2013
My Device: Z10
My Carrier: Vodafone

Re: Not getting location update from QGeoPositionInfoSource.

[ Edited ]

Hi all,

I solved my problem.Actually i was getting time out while requesting location update.I changed it to startUpdate and working fine.

Thanks,