why GPS returning the same Latitude and Longitude when at travel in Android Device? -


in app, getting location in time interval using alarm manager. here code,

in locationlistenstart.java (it's broadcastreceiver class):-

intent intentp = new intent(context, locationreceiver.class); pendingintent = pendingintent.getbroadcast(context, 0, intentp, pendingintent.flag_one_shot);  criteria = new criteria();  criteria.setaccuracy(criteria.accuracy_fine); provider = locationmanager.getbestprovider(criteria, true); if(provider != null) {     locationmanager.requestsingleupdate(criteria, pendingintent); } 

in locationreceiver.java:-

public class locationreceiver extends broadcastreceiver {    string locationkey = "";    double mlatitude=0.0;    double mlongitude=0.0;    public void onreceive(context context, intent intent)     {      locationkey = locationmanager.key_location_changed;      if (intent.hasextra(locationkey))       {         mlatitude = location.getlatitude();         mlongitude = location.getlongitude();      }      if(locationlistenstart.locationmanager != null)      {         locationlistenstart.locationmanager.removeupdates(locationlistenstart.pendingintent);      }    } } 

i have tested app in htc device, times sending duplicate location when @ traveling, if travel 2 hours not getting same lat , long values, when trying use 5 hours continuous travel @ time duplicate location sending 3 5 minutes. times getting duplicate location when gps not available. in samsung device problem not happened, htc device getting problem. how solve issue?


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -