0

I am making an application for GPS tracking. I create LocationManager and set requestLocationUpdates.

LocationManager myManager = (LocationManager) mMap.getSystemService("location");
myManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,MIN_TIME, MIN_DISTANCE, this);

How to select the optimal parameters MIN_TIME and MIN_DISTANCE for the battery and recording the normal track? Please, give me reason for the answer.

Thanks in advance!

UPD: I need the optimal parameters. How to detect the location, I know!

ArtKorchagin
  • 4,801
  • 13
  • 42
  • 58
  • what kind of application are you developing? MIN_TIME and MIN_DISTANCE can be calculated based on your requirement – abbas.aniefa Jun 05 '12 at 08:56
  • GPS tracking and recording your way. My requirement is minimum electricity consumption with maximum accuracy, as it is possible. – ArtKorchagin Jun 05 '12 at 09:01

1 Answers1

0

locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListner); location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

Jay Thakkar
  • 743
  • 1
  • 5
  • 24
  • also give the permissions in manifest file....INTERNET,ACCESS_FINE_LOCATION,ACCESS_COARSE_LOCATION,ACCESS_LOCATION_EXTRA_COMMANDS,ACCESS_MOCK_LOCATION,CONTROL_LOCATION_UPDATES – Jay Thakkar Jun 05 '12 at 08:37
  • If to specify MIN_TIME=0 and MIN_DISTANCE=0, as you, notifications will be obtained as frequently as possible. I want to know what options to select the most optimal for the electricity consumption – ArtKorchagin Jun 05 '12 at 08:45
  • Criteria myCriteria = new Criteria(); myCriteria.setAccuracy(Criteria.ACCURACY_HIGH); myCriteria.setPowerRequirement(Criteria.POWER_LOW); // let Android select the right location provider for you String myProvider = locationManager.getBestProvider(myCriteria, true); // finally require updates at -at least- the desired rate long minTimeMillis = 600000; // 600,000 milliseconds make 10 minutes locationManager.requestLocationUpdates(myProvider,minTimeMillis,0,locationListener); – Jay Thakkar Jun 05 '12 at 08:47
  • go with the code which i gave u now it will help you out i think this is the solution u are finding of – Jay Thakkar Jun 05 '12 at 08:49
  • Notifications will be obtained as once at 10 minutes? – ArtKorchagin Jun 05 '12 at 08:54
  • minTime : the minimum time interval for notifications, in milliseconds. This field is only used as a hint to conserve power, and actual time between location updates may be greater or lesser than this value. – Jay Thakkar Jun 05 '12 at 08:57
  • minDistance : the minimum distance interval for notifications, in meters – Jay Thakkar Jun 05 '12 at 08:57
  • I know it! I want record my way, using GPS. What is the path I write it down, if GPS is updated every 10 minutes? I need the normal parameters for energy conservation and for the record paths. – ArtKorchagin Jun 06 '12 at 08:52
  • do you want to draw the path or what ? – Jay Thakkar Jun 06 '12 at 09:19
  • see i havent done this but this link might be helpful to you please see it http://stackoverflow.com/questions/2023669/j2me-android-blackberry-driving-directions-route-between-two-locations/2023685#2023685 – Jay Thakkar Jun 07 '12 at 06:25