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
Posts: 93
Registered: ‎08-20-2013
My Device: BB 10 -BlackBerry Z10
My Carrier: BlackBerry
Accepted Solution

Device Location issue

 Hello ,      

 

      I need to get device location in my app an dI have done following code for this 

 

     Double   latitude = pos.coordinate().latitude();
     Double   longitude = pos.coordinate().longitude();

	QString lat = QString::number(latitude,'g',12);
	QString longi = QString::number(longitude,'g',12);

But values of lat,longi are not giving accurate values .

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Device Location issue

Have you looked at the Location Diagnostics sample app?

 

http://developer.blackberry.com/native/sampleapps/

 

I suggest you download it and run it, if it works correctly the I suggest comparing its code to your own to see where you might be going wrong.

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Regular Contributor
Posts: 93
Registered: ‎08-20-2013
My Device: BB 10 -BlackBerry Z10
My Carrier: BlackBerry

Re: Device Location issue

That sample app also showing the same value for lat,long. 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Device Location issue

Okay are you using a device or the simulator?

 

Why exactly do you think the numbers are wrong and what are you expecting them to be?

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Device Location issue

are your positions from GPS or WIFI ?

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Regular Contributor
Posts: 93
Registered: ‎08-20-2013
My Device: BB 10 -BlackBerry Z10
My Carrier: BlackBerry

Re: Device Location issue

using WiFi for positioning.

Regular Contributor
Posts: 93
Registered: ‎08-20-2013
My Device: BB 10 -BlackBerry Z10
My Carrier: BlackBerry

Re: Device Location issue

Hello BBSJdev,

     I am using device . and the numbers are wrong because I checked those values on map. Its showing the location which is 4-5 km apart from the current device location . Also checked lat , long of current device location on web by giving address ,but those are different than what application is showing.

Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Device Location issue


dhirajnangare wrote:

using WiFi for positioning.


then perhaps from your router there's a wrong position

 

I had this at conferences, where a router inside a conference venue was before in another city and I got the position from this city. sometimes it needs some time before getting the right position. try to switch between radio network and your wifi. perhaps it helps to relocate.

.... only an idea what could happen

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Regular Contributor
Posts: 93
Registered: ‎08-20-2013
My Device: BB 10 -BlackBerry Z10
My Carrier: BlackBerry

Re: Device Location issue

Thank  you so much ekke,

   If I use GPS positioning then could it give the correct location parameters ? 

Highlighted
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Device Location issue

GPS should give you the right positions ... if accuracy is good

 

about the way of providers to get the position via WIFI I don't have detailed informations,

but I know it took some time for new or moved routers

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner