BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 06-21-2011, 01:42 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2011
Model: 8900
PIN: N/A
Carrier: Torch
Posts: 59
Post Thanks: 3
Thanked 1 Time in 1 Post
Default Detect Location from GPS

Please Login to Remove!

Hello,

I want to get location in such a way if user select "select GPS" in the application then app must detect location automatically. I dont know which api to use to get location detected through api

can any body give me a little guidance

NOTE: DONT REPLY IF YOU DONT KNOW
Offline  
Old 06-21-2011, 07:14 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default Re: Detect Location from GPS

See this video:

Introduction to GPS and BlackBerry - BlackBerry Support Community Forums
Offline  
Old 06-21-2011, 12:08 PM   #3 (permalink)
New Member
 
Join Date: Jun 2011
Model: 7100T
PIN: N/A
Carrier: SEO
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Detect Location from GPS

Hi,

I am also facing the problem with my blackberry. I am unable to detect the location automatically. I don't know which application I should use to detect the location. Can you help me please.
Offline  
Old 06-23-2011, 01:35 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2011
Model: 8900
PIN: N/A
Carrier: Torch
Posts: 59
Post Thanks: 3
Thanked 1 Time in 1 Post
Default Re: Detect Location from GPS

I use separate class Location Tracker that create object of Criteria and Location provider in such a way:

Criteria c= new Criteria();
c.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
c.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
c.setCostAllowed(true);
c.setPreferredPowerConsumption(Criteria.POWER_USAG E_HIGH);
lp= LocationProvider.getInstance(c);
lp.setLocationListener(new MyLocationListener(), 1, 1, 1);

and this is listener code:

private class MyLocationListener implements LocationListener {
public void locationUpdated(LocationProvider provider, Location location)
{
if(location != null && location.isValid())
{
QualifiedCoordinates qc = location.getQualifiedCoordinates();

try {
LocationTracker.this.longitude = qc.getLongitude();
LocationTracker.this.latitude = qc.getLatitude();
} catch(Exception e) {
System.err.println("criccomini " + e.toString()); }
}
else
{
System.err.println("criccomini location not valid");
}
}

I made getter & setter for latitude & longitude in Location Tracker class & call methods of Location Tracker to get latitude & longitude & display on screen. But it shows me values as latitude: 0.0 & longitude: 0.0.

I got this information from net:
By default, if you are using Eclipse with a BlackBerry simulator, it will not have GPS enabled. This is because the default device for the simulator doesn't support GPS. To enable it, you must change the device in the project properties to a BlackBerry device that comes with GPS.

I am currently testing on bold 9700, torch 9800 but it shows me same result

Any one have idea why it gives latitude & longitude as 0.0
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: Detect Location from GPS
Thread Thread Starter Forum Replies Last Post
Sending GPS location info to server after device reboot. BB1364 Developer Forum 4 06-11-2010 10:27 PM
BB Bold GPS...assisted? Skeets General 9000 Series Discussion - Bold 21 07-30-2008 07:08 PM
New App - locaTags - location on your Blackberry without GPS goelectric Aftermarket Software 0 06-05-2008 09:37 AM
Review: Beyond411 With GPS Support AKA Berry411 Entropy666 BBF Reviews 3 07-22-2007 10:37 PM





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.