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
New Developer
becker666
Posts: 128
Registered: ‎04-12-2010
My Device: Storm
My Carrier: Verizon

positionUpdated GPS fixes

I folowed these instructions to get continous fixes e.g. a path with values 

 

https://developer.blackberry.com/cascades/documentation/device_platform/location/retrieving.html

 

on my 1st test the coordinates never changed they were the same I was doing this on a car. The altitude started as nan the got some vaues that looked ok and went back to nan. I set the rate at 0.5 secs

 

I read that sattelites take a few mins to get a lock to get something I set it as below to get network positioning so I tried, (restartng so it sticks)

GPS_src->setProperty( "provider", "hybrid" ); 
GPS_src->setProperty( "canRunInBackground", true ); 

 

here I get nothing or I guess the positionUpdated never gets called. So what is the best way to record positioning I need lon/lat/altitude sampled continously. And then generating a KML file (that is the easy stuff)

 

  Cheers

 

 

 

Please use plain text.
Developer
sorout2009
Posts: 104
Registered: ‎08-23-2012
My Device: Blackberry Z10
My Carrier: TATA DOCOMO

Re: positionUpdated GPS fixes

For alternate you can use PositionSource in Qml to get lat lon values like below
attachedObjects: [
PositionSource {
id: positionSource //! Desired interval between updates in milliseconds
updateInterval: 10000 //! When position changed, update the location strings
onPositionChanged: {
var currentCoord = positionSource.position.coordinate;
var lat = currentCoord.latitude;
var lon = currentCoord.longitude;
}
}
]

positionSource.start(); For start updating position
Dharmender Singh
Please use plain text.
BlackBerry Development Advisor
jehrismann
Posts: 68
Registered: ‎10-15-2012
My Device: Z10
My Carrier: Telus

Re: positionUpdated GPS fixes

[ Edited ]

Hi,

 

The altitude being a nan is consistent with a position fix that comes from wifi or cellular network. See this post for more info. And you are right, the gps provider is often slower at getting its first fix than the wifi or cellular providers, so seeing the altitude as nan initially and then getting reasonable values is consistent with this (when you set the provider property to "hybrid").

 

It's clearly odd that the coordinates are not changing while in a moving car. Somehow you are only picking up the first value (?) Here's full sample code for getting a device's position. It's specific to getting just a cellular network fix every couple of minutes. But if you change NonSatellitePositioningMethods to SatellitePositioningMethods (for gps only) or AllSatellitePositioningMethods (for the best method available-same as setting the provider property to "hybrid"), and set the update interval to 1000 (this is 1 sec, which is the fastest rate you can get) instead of 120000, you should get what you want. Also, you should remove the call to set the fixType property completely.

 

If you still have trouble getting it working feel free to share more of your code so we can have a look.

 

Regards,

Jim

Please use plain text.
New Developer
becker666
Posts: 128
Registered: ‎04-12-2010
My Device: Storm
My Carrier: Verizon

Re: positionUpdated GPS fixes

[ Edited ]

Thanks guys appreciate the feedback ....actually the hybrid did work but it had to try it a couple times, this seems to be a pattern anytime I compile  a new version (with something not being there before) most of the time the 1st time it doesn't stick. 

 

But on the GPS side after it started sampling at 0.5 secs interval it did good & I tested my export to KML and see my path on the map almost exactly as I drove it. So no complains there. I'm not sure how this would behave on a non-network area and just sampling from the GPS I'll give that a shot later on.

 

A bit off tangent here but ideally if I could load the KML to google maps in the BB browser I'd be on my way on this task  on iOS/Android I can pull the google maps URL and pass the kml as an arg and it pops my path with the custom Placemarks but on the BB browser is pretty quirky the closes I've got was to display a point but the path never displayed.  Sorry 4 the off topic

 

 

Please use plain text.
BlackBerry Development Advisor
jehrismann
Posts: 68
Registered: ‎10-15-2012
My Device: Z10
My Carrier: Telus

Re: positionUpdated GPS fixes

Is this post relevant?

Please use plain text.
New Developer
becker666
Posts: 128
Registered: ‎04-12-2010
My Device: Storm
My Carrier: Verizon

Re: positionUpdated GPS fixes

Yep it is relevant  .... but no solution 

Please use plain text.