Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internet data usage by Android LocationManager

Does Android LocationManager sometimes uses multi-megabytes of internet data when obtaining position fixes? And if so, in what circumstances? Can it happen even when the app that uses the LocationManager has no explicit permission to access the internet?

I ask this because I have recently noticed that internet data used by "Android OS" (as reported by the Settings->"Data usage" screen on my Samsung Galaxy Note with Android 4.0.4) is sometimes 10 megabytes or more per day. Experimentation suggests that this data usage occurs only when I run an app that I have written and which uses GPS position data supplied by the Location Manager. When this app is not running "Android OS" only uses a few kilobytes of data per day.

The only permissions in the app's manifest are "android.permission.ACCESS_FINE_LOCATION" and "android.permission.WRITE_EXTERNAL_STORAGE". There is no permission for internet access.

The activity's onStart() method contains the code:

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

Similar code is called when the ignoreGPS flag is toggled off.

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 only called rarely, when the ignoreGPS flag is toggled off or when the user selects a menu option to go to the last known location.

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

Does GPS_PROVIDER use "assisted GPS" by default? If so, could this use multi-megabytes of data? Even if there is no internet permission?

If GPS_PROVIDER is unable to get a fix from GPS signals does LocationManager by default use the cell phone network? Even if the app has no network permission? Would this be counted by the phone provider as internet data access?

like image 876
prepbgg Avatar asked Aug 29 '12 18:08

prepbgg


1 Answers

No never, the SUPL protocol that downloads assistance data only uses a few kilobytes of data. Even if you run it a lot during the day it won't be much compared to say browser usage.

Google sometimes uploads WiFi data and application usage (creepy I know), when using the NETWORK_PROVIDER. But even that isn't much.

Can you try killing all the background processes or better uninstalling unwanted apps?

My best guess is that you could be using a MapView which downloads Map tiles and satellite imagery - this data is heavy

like image 117
Reno Avatar answered Sep 23 '22 18:09

Reno