I m working on a project which requires constant location updates of my android phone. It works alright but, is highly inaccurate. Indoors i was getting accuracy of fetched location (via getAccuracy()) to be around 60(which as far as i know is in meters), where as i want accuracy to be in (at max) 2-3 meters. Firstly, Is t possible to obtain accuracy of (2-3 meters) constantly? If Yes, how?
Follow is the code piece i m using to fetch user location.
public boolean getLocation(Context context, LocationResult result) { //I use LocationResult callback class to pass location value from MyLocation to user code. locationResult = result; if(lm==null) lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); //exceptions will be thrown if provider is not permitted. try{gps_enabled=lm.isProviderEnabled(LocationManager.GPS_PROVIDER);}catch(Exception ex){} try{network_enabled=lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);}catch(Exception ex){} //don t start listeners if no provider is enabled if(!gps_enabled && !network_enabled) return false; if(gps_enabled) lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListenerGps); if(network_enabled) lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListenerNetwork); timer1=new Timer(); timer1.schedule(new GetLastLocation(), 10000); return true; }
I was also getting another issue, with my device constantly placed at a static location, the distance between two successive GPS Location fetched is highly unreliable, it changes from 0.0 meters to 16meters, which means that my device is constantly moving.
If any of you have any idea about this preferably how to achieve accuracy please help me.
Thanks