*I'd start with this:*
*mlocManager.requestLocationUpdates (provider, 1000, 0, mlocListener);* ** ** *Then, if you want to conserve energy, you can experiment with upping the time and distance.* ** On Thursday, October 11, 2012 7:41:03 AM UTC-5, sanjay wrote: > > I am developing an application that tracks the device's location specially > when it is moving. I am getting different response in Samsung and HTC > device having different OS version for same API call. > > Here is my code. > > private static final long HUNDERE_METERS = 100; // in Meters > private static final long TWO_MIN = 60000*2; // in Milliseconds > > > Criteria criteria = new Criteria(); > criteria.setAccuracy(Criteria.ACCURACY_FINE); > criteria.setBearingRequired(true); > criteria.setBearingAccuracy(Criteria.ACCURACY_HIGH); > criteria.setHorizontalAccuracy(Criteria.ACCURACY_HIGH); > String provider = mlocManager.getBestProvider(criteria, false); > mlocManager.requestLocationUpdates(provider, TWO_MIN, HUNDERE_METERS, > mlocListener); > > 'Samsung Galaxy Nexus-4.1.1' gives the location updates on every distance > moved by HUNDRED_METERS (100 meters) which is fine. But in 'HTC EVO 3D > PG86100-4.0.3' GPS become unavailable for 2 minutes and then become > available which is causing location updates after every 2 minutes. > > I modified the code as below > requestLocationUpdates(LocationManager.GPS_PROVIDER, TWO_MIN, > HUNDERE_METERS, mlocListener); > Now HTC start working fine and giving locations for every distance moved > by 100 meters but in Samsung GPS become unavailable for every 2 minutes. > > Please suggest with what argument should I call requestLocationUpdates to > get location updates for distance moved by desired distance which should > work for all Android devices and OS. > > Will appreciate your feedback greatly. > > Sanjay > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

