[Android Q&A, Help & Troubleshooting] nmthewarrior:
I have an application which is installed in the phones cab drivers use to track the location and distance traveled by the cab. (The phone is rooted and we have all privileges on the phone). In the first implementation of our application we used LocationManager.requestLocationUpdates to get location updates from GPS and Network providers. Since we need to capture every kilometer traveled by the cab we enabled "High Accuracy" mode in location settings.

For two reasons we are willing to move to Fused-location-provider

For some reason (a known bug in android: https://code.google.com/p/android/issues/detail?id=57707) NETWORK_PROVIDER is not providing location updates.

For some reason the devices are suddenly loses GPS fix and are not gaining again until the device reboots.

We observed that FusedLocationProvider is giving better results and are planning to change our application to use FusedLocationProvider. Now the problem is - our devices have an older version of GooglePlayServices which does not have LocationServices. Two options we have are

Use older version of FusedLocationProvider using LocationRequest and LocationClient. Though it is giving good results outdoors(which is our primary requirement), we are not getting location updates(not-at-all) indoors even with wifi enable and with good network signal (This also seems to be a known issue (Location updates not working indoors as claimed by Fusion Location Provider APIs). So, i suspect there could be some bugs in older version of GooglePlayServices and/or FusedLocationProvider which would have been fixed in later versions.

Update GooglePlayServices on all phones (by installing apk over the air) and use LocationServices to get location updates with high accuracy as priority. This implementation is giving location updates even indoors which is what we expect -- Here the problem is when I update GooglePlayServices with an apk when I request location updates in my application it is opening 2 popups one asking for confirmation to improve location accuracy and the other is to turn on ability for google apps to use my location. It is working fine even if I don't accept second popup but if I don't accept the first popup it is changing the location setting to "Device Only" mode (which means only GPS provider is used).

Improve Location Accuracy https://40.media.tumblr.com/53af918884f8ab444ec6352e3e710007/tumblr_npfjbwwnKV1uxztu6o1_540.jpg

Permission to enable google apps to use location

https://40.media.tumblr.com/0eb9a64f55032fe2250a18dd6e0755cc/tumblr_npfjbwwnKV1uxztu6o2_540.jpg

We can not expect all our drivers to accept the popup when it is shown. I would like to know if there is any way I can do "default accept" kind of thing for the first popup so that my devices remain in "High Accuracy" mode.

I found a solution to disable location consent which comes when high accuracy mode is enabled manually in Location Settings as suggested in http://xdaforums.com/galaxy-s2/themes-apps/mod-disable-google-location-consent-t2791431 That solution was working with our old application but with updated GooglePlayServices it is not working. I saw some google-play-services-MOD-apks out there on net so I thought it would be possible to modify the apk, sign it and install it., but when I try to modify the Google play services apk and signit with one click signer and install it is failing with inconsistent certificates error.

Any way of achieving this - like executing a command in device shell , issuing an intent or modifying the GooglePlayServices apk itself is fine with me.

Device Type : MotoE - XT1022

Android Version : 4.4.4

Build Number : KXC21.5-40