Problem with Finding with Geo Coordinates

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Problem with Finding with Geo Coordinates

Postby rsgiridaran » Thu Dec 03, 2009 4:38 pm

I am developing an application which uses the current location of the
user to do some operations. i have used LocationManager and
LocationListener to receive the latitude and longitude values in
onLocationChanged() method. it is perfectly working when i am testing
using emulator control in eclipse. when its accessing from the real
device its not functioning properly. its will give 0, 0 for latitude
ad longitude.
Here is my code which used to get the current location.

public GeoLocationManger(Activity activity) {
LocationManager locationManager = (LocationManager) activity
.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
List providers = locationManager.getProviders(criteria,true);
if(providers != null && providers.size() >0){
LocationProvider pro =locationManager.getProvider(providers.get
(0).toString());
locationManager.requestLocationUpdates(pro.getName(), 0, 0, this);
}
else
{
Messages.displayMessageOnUI(GasBuddyConstants.INFO,
"GPS Not Enabled – Update your settings.",
activity);
}
}
public void onLocationChanged(Location location) {
this.latitude = location.getLatitude();
this.longitude = location.getLongitude();
}
/*code*/I am developing an application which uses the current location of the
user to do some operations. i have used LocationManager and
LocationListener to receive the latitude and longitude values in
onLocationChanged() method. it is perfectly working when i am testing
using emulator control in eclipse. when its accessing from the real
device its not functioning properly. its will give 0, 0 for latitude
ad longitude.
Here is my code which used to get the current location.
/*Code*/
public GeoLocationManger(Activity activity) {
LocationManager locationManager = (LocationManager) activity
.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
List providers = locationManager.getProviders(criteria,true);
if(providers != null && providers.size() >0){
LocationProvider pro =locationManager.getProvider(providers.get
(0).toString());
locationManager.requestLocationUpdates(pro.getName(), 0, 0, this);
}
else
{
Messages.displayMessageOnUI(GasBuddyConstants.INFO,
"GPS Not Enabled – Update your settings.",
activity);
}
}
public void onLocationChanged(Location location) {
this.latitude = location.getLatitude();
this.longitude = location.getLongitude();
}
/*Code*/
is there any settings need to do with phone?
Please help me to resolve this.
Thanks in advance.

is there any settings need to do with phone?
Please help me to resolve this.
Thanks in advance.
rsgiridaran
Freshman
Freshman
 
Posts: 7
Joined: Wed May 06, 2009 2:42 pm

Top

Try this.

Postby pranav09 » Tue Jan 12, 2010 10:58 am

Hi rsgiridaran,

As per the your problem i would suggest the below link.

http://www.devx.com/wireless/Article/39239/1954

When you run the application first time, if it gives you "No Location Found!" as a message, follow the below steps to get latitude and longitude.

Menu: Window-> Show View-> Other-> Emulator Control
Now, you can enter latitude and longitude manually. You can use Latitude: 23.033333 & Longitude: 72.666667 as a reference.

Just go through it. Lets hope, it may help you to resolve your problem.

Regards,
____________
Pranav
User avatar
pranav09
Senior Developer
Senior Developer
 
Posts: 128
Joined: Mon Jan 19, 2009 12:01 pm
Location: Ahmedabad, India

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 7 guests