Wednesday 15 September 2010

android maps always returning same position -



android maps always returning same position -

i'm trying send current position android app developed me server provider send same position , not position can see point marker.

i request location updates this:

// getting locationmanager object scheme service location_service. locationmanager locationmanager = (locationmanager) getsystemservice(location_service); // creating criteria object retrieve provider. criteria criteria = new criteria(); criteria.setaccuracy(criteria.accuracy_coarse); criteria.setbearingrequired(true); // getting name of best provider. string provider = locationmanager.getbestprovider(criteria, true); locationmanager.requestlocationupdates(provider, 2, 2, this);

and lat , long that:

public void onlocationchanged(location location) { location currentlocation; location nextlocation; if (mapvisible == true) { // creating latlng object current location. latitude = location.getlatitude(); <--------here longitude = location.getlongitude(); <--------here ...

but server receive same position. tip problem? thanks

there's many reasons that. maybe because you're connected wi-fi network , gps off, phone location ip address, location ip address same.

furthermore, you're using criteria , locationmanager.getbestprovider();, homecoming same provider based on criteria. ignoring other locations provided other provider didn't match criteria.

if wondering why location isn't same bluish point marker, can seek switching android location apis play services location apis, it's more accurate , more simple. more info : https://developer.android.com/google/play-services/location.html

google-maps android-mapview android-maps-v2

No comments:

Post a Comment