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

Trusted Contributor
Posts: 132
Registered: ‎10-01-2012
My Device: Playbook
My Carrier: CMCC

Efficient way to get the geolocation of the device?


My app needs the geolocation of the user in latitude, longitude. It doesn't need to be precise, city level precision will do. But it needs to be right.


The possible solutions in mind are-


1. Insert a database of country,city,latitude,longitude in the app. The user will choose the location from the drop down list.

Pros: Offline location selection. Doesn't need to use GPS. 

Cons: list of all cities will be relatively large database which will significantly increase the size of the app.


2. Use a location server or API (typically based on IP location) to determine the location of the user.

Pros: Quick. 

Cons: User needs to be connected online. The percentage of accuracy is lower.


3. Using GPS in device.

Pros: Very precise. 

Cons: Will take long time to get the GPS location. Will not work indoor. 



My questions are-

1. Is there any API for  "last location" or "latest location" of the device which will output the last/latest location in latitude/longitude?

2. Is there any accessible native list of countries and cities in the device?

3. What is the efficient and user friendly way to find the (not so precise,but right) location of the device?


Please use plain text.
Forums Veteran I
Posts: 1,923
Registered: ‎11-28-2011
My Device: PlayBook 64 GB & Torch 9860
My Carrier: Cogeco

Re: Efficient way to get the geolocation of the device?

For the PlayBook I have purchased an App called What's Up for 0.99. It is an excellent Astronomy App showing the sky wherever you are. After you install it, you set your PlayBook outside in an area where it can see the sky. Wait about 15 minutes and it will detect the GPS satellites and give you your latitude and longitude. Once it is initially setup, you can get the latitude and longitude wherever you go from the program. I can't help with your phone but I think there is also a GPS setting on it.
Please use plain text.