OneBusAway / onebusaway-android

The official Android app for OneBusAway
http://www.onebusaway.org/
Other
470 stars 288 forks source link

Make background location permission configurable for rebranded apps in build.gradle #1092

Open barbeau opened 2 years ago

barbeau commented 2 years ago

Summary:

Some rebranded versions of OBA Android may have trouble getting published to Google Play because of the use of background location in the opt-in travel behavior study depending on who is reviewing the Google Play app update application (feedback from Google Play is very inconsistent).

To avoid this headache, we can add a configuration option that effectively removes background location from rebranded apps if the developers want to remove it.

My notes to someone interested in this and the current manual process you'd need to go through:

If you want to remove background location from the whitelabel app entirely you can try removing the “ACCESS_BACKGROUND_LOCATION” from the AndroidManifest.xml:

https://github.com/OneBusAway/onebusaway-android/blob/master/onebusaway-android/src/main/AndroidManifest.xml#L31

…and comment out this code in HomeActivity:

https://github.com/OneBusAway/onebusaway-android/blob/master/onebusaway-android/src/main/java/org/onebusaway/android/ui/HomeActivity.java#L387-L388

        new TravelBehaviorManager(this, getApplicationContext()).
                registerTravelBehaviorParticipant();

This should effectively disable the ability for a user to opt-into the research study by not showing the initial dialog.

Depending on how much static analysis of the code they’re doing, you might need to remove the code that calls for the background location permission too (otherwise they will think you’re still doing background location, even though it’s impossible to actually trigger this code from executing):

https://github.com/OneBusAway/onebusaway-android/blob/master/onebusaway-android/src/main/java/org/onebusaway/android/ui/HomeActivity.java#L1833

                            activity.requestPermissions(TravelBehaviorConstants.BACKGROUND_LOCATION_PERMISSION, BACKGROUND_LOCATION_PERMISSION_REQUEST);

Steps to reproduce:

Build a rebranded version such as Agency X (see https://github.com/OneBusAway/onebusaway-android/blob/master/REBRANDING.md)

Expected behavior:

Give the developer an option to not allow users to opt into travel behavior study and remove the background location permission

Observed behavior:

You need to manually remove the background location configuration and travel behavior study popup.

Device and Android version:

N/A

HimanshuMahto commented 6 months ago

hey there, I would like to work on this issue