Finding the location of a mobile device

The Location Acquisition API allows applications to access the location information of a mobile device regardless of the location technology used.

Typical use cases include:

  • Finding the location of a mobile device by using the Global Positioning System (GPS).

  • Finding the location of a mobile device by network based positioning.

  • Basic calculations using location information such as distances, bearing, and timestamp (see TPosition and Extended location information).

Important implementation considerations include:

  • Applications should close their RPositioner when they do not need positioning for an extended period of time. Also, when staying in background for more then a minute.

  • The system automatically selects an appropriate positioning method, based on the type of the class given as input for Open (RPositionServer &aPosServer) method. The system tries all available methods until it succeeds. Generally applications use this method. For special cases, applications can use Open (RPositionServer &aPosServer, TPositionModuleId aModuleId) to force system to use specified positioning method. In that case system does not fallback in case of failure

Note:

The Symbian SDK does not have a Map API, and therefore you must use a third party API to display the location information you receive on a map.

Getting the location of a device

To find the location of a mobile device:

  1. Use the methods of the Location Acquisition API to construct your application.

    The RPositionServer and RPositioner classes are particularly relevant in getting the location of your device, which is typically stored in the TPositionInfo class.

    For information on some detailed uses of the API, see the Location Acquisition API Usage section for:

    • a list of the steps required for finding the location of a mobile device in a basic use case

    • how to obtain the current location estimate

    • how to obtain an extended location estimate, including information such as bearing, speed, and available satellites, which is not normally returned with the current location estimate

    • how to obtain your last known position information, using cached information if available. This means that this method does not retrieve the location information from the underlying positioning methods.

  2. Make sure lbs.lib is accessible to your linker when compiling your application by including it in your mmp file or by editing the project properties in your IDE, depending on your build environment.

  3. Make sure you have the correct capabilities information set for your application, depending on your application you need at least Location.

Additional information on locating your device

For more information, see:

  • The purpose and general overview of the Location Acquisition API.

  • The description and class structure of the API.

  • A general overview on how to create applications using the API.

  • The LocationRefAppForS60 in the SDK (<SDK installation directory>\S60CppExamples\AutoAdaptedToTouchEx), for an example of how to use the Location Acquisition API.

Related APIs

The Symbian platform also offers the following related services: