Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are completely right, the minimum time 45 seconds is harcoded in Android.</p> <p>This seems to be a NetworkLocationProvider class source code, when it was still in Android core:</p> <p><a href="http://www.netmite.com/android/mydroid/frameworks/base/location/java/com/android/internal/location/NetworkLocationProvider.java">http://www.netmite.com/android/mydroid/frameworks/base/location/java/com/android/internal/location/NetworkLocationProvider.java</a></p> <p>Look at the variable:</p> <pre><code>private static final long MIN_TIME_BETWEEN_WIFI_REPORTS = 45 * 1000; // 45 seconds </code></pre> <p>And the method:</p> <pre><code>@Override public void setMinTime(long minTime) { if (minTime &lt; MIN_TIME_BETWEEN_WIFI_REPORTS) { mWifiScanFrequency = MIN_TIME_BETWEEN_WIFI_REPORTS; } else { mWifiScanFrequency = minTime; } super.setMinTime(minTime); } </code></pre> <p>Now NetworkLocationProvider is out of the Android core, you can find it in NetworkLocation.apk in /system/app</p> <p>You can find an explanation of why is out of the core here:</p> <p><a href="https://groups.google.com/forum/?fromgroups=#!topic/android-platform/10Yr0r2myGA">https://groups.google.com/forum/?fromgroups=#!topic/android-platform/10Yr0r2myGA</a></p> <p>But 45 seconds min time seems to still be there. Look at this NetworkProvider decompilation:</p> <p><a href="http://android.fjfalcon.com/xt720/miui-trans/apk-decompiled/NetworkLocation/smali/com/google/android/location/NetworkLocationProvider.smali">http://android.fjfalcon.com/xt720/miui-trans/apk-decompiled/NetworkLocation/smali/com/google/android/location/NetworkLocationProvider.smali</a></p> <pre><code>.line 149 const-wide/32 v4, 0xafc8 iput-wide v4, p0, Lcom/google/android/location/NetworkLocationProvider;-&gt;mWifiScanFrequency:J </code></pre> <p>As you might guess if you convert 0xafc8 to decimal you get 45000 milliseconds</p> <p>I haven't found an explanation of why 45 seconds. I suppose there will be reasons like avoiding service overloading or other uses they don't want.</p> <p>In fact, there is a 100 request courtesy limit to Geolocation API:</p> <p><a href="https://developers.google.com/maps/documentation/business/geolocation/#usage_limits">https://developers.google.com/maps/documentation/business/geolocation/#usage_limits</a></p> <p>But they don't seem to respect this rule in Google Maps app. If you open it and you only active network location you can notice that yout location is updated much more frequently than 45 seconds.</p> <p>I noticed this line suspiciously frequent (33 times a second) in logcat when Google Maps is open:</p> <p>02-20 17:12:08.204: V/LocationManagerService(1733): getAllProviders</p> <p>I guess Google Maps is also calling removeUpdates() and requestLocationUpdates() again to obtain a new position.</p> <p>So I think there is no fix and this is the best you can do if you want to get network locations over one in 45 seconds.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload