38967

Android: LocationManager.requestLocationUpdates doesn't respect params

Question:

I have a problem recieving notifications from LocationManager after a set period of time:

locationManager = (LocationManager)getSystemService(LOCATION_SERVICE); if(useGPS) { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 999999, 999999, locationListener);

In emulator my location listener's onLocationChanged method gets called whenever I send a fix via emulator control (i.e. every other second) So, the question is - is this because the way I'm testing on emulator, or LocationManager doesn't respect params?

Thanks

Answer1:

The doc says:

minTime - the minimum time interval for notifications, in milliseconds. <strong>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.</strong>

Recommend

  • Get user current position with gps/network android MapView
  • Getting longitude and latitude values faster
  • Getting Repeated Current Location inside a Service in android?
  • NullpointerException when calling getSystemService(Context.LOCATION_SERVICE) and onLocationChanged n
  • Android GPS Provider
  • NullpointerException when calling getSystemService(Context.LOCATION_SERVICE) and onLocationChanged n
  • Android GPS not working in service
  • Unable to get longitude and latitude in android
  • Android AsyncTask & LocationListener
  • Android Device Movement Speed
  • My phone is not moving, but GPS data still changing
  • Accessing findViewById from Service
  • Windows Phone 7 sniffer
  • Saving image file path to sqlite database
  • Is Android development possible on netbooks? [closed]
  • Android cannot disable cut copy paste
  • ASP.NET MVC 2 Preview 2 - display directory list rather than home/index
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • onBackPressed() not being executed
  • Passing 1 of 3 values to a Sub
  • debug library loaded with ctypes using gdb
  • How to install a .deb file on a jailbroken iphone programmatically?
  • Cannot resolve symbol 'MyApi'
  • How to use an array of arrays with array_map(…) in PHP?
  • How to rebase a series of branches?
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Ajax jQuery multiple calls at the same time - long wait for answer and not able to cancel
  • Perl system calls when running as another user using sudo
  • Trying to switch camera back to front but getting exception
  • Statically linking a C++ library to a C# process using CLI or any other way
  • Adding custom controls to a full screen movie
  • SVN: Merging two branches together
  • Load html files in TinyMce
  • Free memory of cv::Mat loaded using FileStorage API
  • Angular 2 constructor injection vs direct access
  • Change div Background jquery
  • How does Linux kernel interrupt the application?
  • Programmatically clearing map cache
  • Busy indicator not showing up in wpf window [duplicate]
  • Why do underscore prefixed variables exist?