Using Internet Data in Android LocationManager

Does the Android LocationManager sometimes use a few megabytes of Internet data when receiving location fixes? And if so, in what circumstances? Could this happen even if an application using the LocationManager does not have explicit permission to access the Internet?

I ask this because I recently noticed that the Internet data used by “Android OS” (as indicated on the settings screen → “Data Usage” on my Samsung Galaxy Note with Android 4.0.4) sometimes amounts to 10 megabytes or more in day. Experimentation assumes that this use of data only occurs when the application I wrote and which uses the GPS position data provided by the location manager is launched. When this application does not work, "Android OS" uses only a few kilobytes of data per day.

The only permissions in the application manifest are "android.permission.ACCESS_FINE_LOCATION" and "android.permission.WRITE_EXTERNAL_STORAGE". No permission to access the Internet.

In the onStart () action, the method contains the code:

if (!mapview .ignoreGPS ) { lm.requestLocationUpdates(LocationManager. GPS_PROVIDER , gpsMinTime , gpsMinDistance , this ); } 

Similar code is called when the ignoreGPS flag is disabled.

There is also a gotoLastLocation () method containing the code:

  Location l = lm.getLastKnownLocation(LocationManager. GPS_PROVIDER ); if (l == null ) { l = lm .getLastKnownLocation(LocationManager. NETWORK_PROVIDER); } 

This method is rarely called when the ignoreGPS flag is disabled or when the user selects a menu item to go to the last known location.

Apart from this rarely called method, there is no reference to "NETWORK_PROVIDER".

Does GPS_PROVIDER use GPS Helper by default? If so, can this use several megabytes of data? Even if there is no internet permission?

If GPS_PROVIDER cannot get a fix from GPS signals, does the LocationManager use a cell phone network by default? Even if the application does not have permission to work on the network? Will it be calculated by the phone provider as access to Internet data?

+6
source share
1 answer

Never, the SUPL protocol that downloads auxiliary data uses only a few kilobytes of data. Even if you run it a lot during the day, it will not be much compared to using a browser.

Google sometimes downloads Wi-Fi data and applications (as far as I know) when using NETWORK_PROVIDER . But even that is not enough.

Can you try to kill all background processes or is it better to remove unnecessary applications?

My best guess is that you can use MapView , which downloads maps and satellite imagery - this data is heavy

+1
source

Source: https://habr.com/ru/post/924115/


All Articles