BlackBerry Java to BlackBerry 10 Cascades Porting Series – Part 9: Location

Native SDK Development

In this part of the porting series we’re going to cover Location APIs to acquire the geo position of a device.

Geo Positioning

Integrating geo positioning in your app is a breeze. Speaking at a high level, BlackBerry 10 supports the following positioning sources.

Multiple Fixes

With only 3 lines of code, you can start a location session for periodic updates.

// Create the position source
QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this); 
// connect the signal to listen for position updates
	SIGNAL(positionUpdated(const QGeoPositionInfo &)),
	SLOT(positionUpdated(const QGeoPositionInfo &))
// Start updates

While this is quick and easy, you can also control other parameters such as the position source or the interval at which location fixes are sent to your slot.

Single Fix

To query for a single location fix, simply change the last line to:

// Request a single update

Sample App
A comprehensive and open source sample application is available at:

You can also read the developer documentation for Location here:

API Documentation

Join the conversation

Show comments Hide comments
+ -