Google Play Store: Required declarations for “Foreground Services” and “Health”
With Android 14 (targetSdkVersion 34
), the Google Play Store now requires declarations for a couple of permissions that the background-geolocation SDK automatically inserts into your app’s AndroidManifest
:
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
These permissions are crucial to the operation of the Background Geolocation SDK.
ACTIVITY_RECOGNITION
TheACTIVITY_RECOGNITION
permission allow the SDK to monitor the Android Motion API to automatically toggle location-tracking ON/OFF based upon the detected motion-activity of the device (eg: on_foot, in_vehicle, on_bicycle, running, still
).
Provide the following required declaration, selecting the category “Other”:
“The app uses the ActivityTransition API to automatically toggle location-services ON when the device is detected be in-motion. When the motion API reports the device is “still”, the app turns OFF location-services to conserve battery. This is a documented use-case for the Activity Transition API according to https://developer.android.com/develop/sensors-and-location/location/transitions”
Permissions — Describe your app’s use of the android.permission.ACTIVITY_RECOGNITION permission
In the next screen, post the same message as above for the “Activity recognition” permission:
I don’t want this permission
Removing the ACTIVITY_RECOGNITION
permission will have major consequences on the performance of the SDK — it will require a much longer distance before the device is detected to be moving (200–1000 meters). With the ACTIVITY_RECOGNITION
permission, the plugin is allowed to monitor the Android Motion API in the background, allowing the SDK to quickly detect when the device is in-motion, typically with just a few meters of movement.
If you want to remove this automatically-added permission from your app, add the following override with tools:node=”remove"
to your AndroidManifest:
<manifest>
<uses-permission
android:name="android.permission.ACTIVITY_RECOGNITION"
tools:node="remove" />
.
.
.
</manifest>
You should also configure the plugin in .ready(config)
with:
disableMotionActivityUpdates: true
FOREGROUND_SERVICE_LOCATION
The FOREGROUND_SERVICE_LOCATION
permission allows the SDK to turn on a foreground-service to constantly monitor the device location, regardless if app is terminated or device rebooted.
The Background Geolocation demo app was successfully published using the following declarations, enabling both “User-initiated location sharing” and “Geofencing”.
The following very simple video was provided for both:
“Your update is live”
After providing the declarations above, the Google Play Store allowed the Background Geolocation demo app to be published.