react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Having an issue with app being recognized as Health App [Android]
Your Environment
- Plugin version: ^4.16.0
- Platform: Android
- OS version: 14
- Device manufacturer / model: Google Pixel 5
- React Native version (
react-native -v): 0.73.8 - Plugin config
{
// Geolocation Config
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 100,
useSignificantChangesOnly: true,
disableElasticity: false,
// Activity Recognition
stopTimeout: 5,
disableMotionActivityUpdates: true,
// Application config
debug: false, // <-- enable this hear sounds for background-geolocation life-cycle.
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
stopOnTerminate: false, // <-- Allow the background-service to continue tracking when user closes the app.
startOnBoot: false, // <-- Auto start tracking when device is powered-up.
url: `${API_URL}/providers/${userSession?.id}/location`,
batchSync: true, // <-- [Default: false] Set true to sync locations to server in a single HTTP request.
maxBatchSize: 5,
autoSync: true, // <-- [Default: true] Set true to sync each location to server as it arrives.
headers: {
// <-- Optional HTTP headers
'X-TUP-Auth-Version': '1',
Authorization: `Bearer ${userSession?.access_token}`,
Accept: 'application/json',
'Content-Type': 'application/json',
'TUP-Device-Os': Platform.OS, // android || ios
'TUP-Device-Id': getDeviceId(),
'TUP-Build-Number': getBuildNumber(),
'TUP-App-Version': getVersion(),
},
params: {},
Expected Behavior
We want to be able to deploy our app into production like we did before with our CI/CD workflow
Actual Behavior
Our issue is not with the plugin itself working in the app, but when trying to deploy it to the play store.
We have recently update our app to react-native version 0.73.8 and we are getting the following error upon trying to deploy the app to production
Steps to Reproduce
There is no way to reproduce this unless when trying to deploy to Play Store
Context
We recently updated our app to use react-native version 0.73.8. The app is working fine and the plugin too, however we get an error when trying to run it via our CICD pipeline. The app is built fine, however when trying to publish it to play store, we get the following error:
Upon doing additional checks, we noticed that PlayStore is recognizing our app as a Health App due to it's usage of the android.permission.ACTIVITY_RECOGNITION permission. We have checked our code and we do not have this permission anywhere in our Manifest file, although it is configured in the plugin. We also have disabled the motionActivityUpdates as per the config file.
Is there a way for us to remove this permission so our app is not recognized a health app anymore?
This is what shows up in our play console:
Debug logs
Logs
The plug-in uses requires this permission to use Motion API for automatically toggling location-services ON/OFF.
so should we just set the app as a Health app and fill the forms? we can use your description as the reason for having the permission
Yes.
I have the same problem, play store is detecting my application as if it were HEALTH, however I require the ACTIVITY_RECOGNITION permission since the react-native-background-geolocation library needs it.
It will be enough if I use this description "The plug-in uses requires this permission to use Motion API for automatically toggling location-services ON/OFF." to justify why I'm using the ACTIVITY_RECOGNITION permission: ? since I need to publish the application in the Play store.
I wouldn’t use the phrase “the plug-in”. Reviewers don’t know or care about plug-ins. It’s “my app”.
I'm going to use the following justification: "My app requires the ACTIVITY_RECOGNITION permission to use the Motion API to automatically turn location services on/off based on user activity. This optimizes battery life and improves tracking accuracy. We'll use this permission responsibly." I think it is important how it should be justified since it is a problem that those who use the library are having.
Does the justification seem good to you?
It sounds perfect. I would also add a shorter phrase about it on the “prominent disclosure”.
see step 5 at my blog here:
https://transistorsoft.medium.com/new-google-play-console-guidelines-for-sensitive-app-permissions-d9d2f4911353
I'm going to use the following justification: "My app requires the ACTIVITY_RECOGNITION permission to use the Motion API to automatically turn location services on/off based on user activity. This optimizes battery life and improves tracking accuracy. We'll use this permission responsibly." I think it is important how it should be justified since it is a problem that those who use the library are having.
Does the justification seem good to you?
Hello! @aaldavea, was the application with this justification approved? Are there people who managed to obtain this permission to collect geodata?
It was approved 👍
Good news: I've found a way to enable motion-activity updates in the background without FOREGROUND_SERVICE_HEALTH permission. Will be released in the next version v4.16.3.
See my latest blog-post about this
fyi, if your having issues completing the google health app submission then it needs to be complete by the ACCOUNT OWNER. The UI doesn't tell you that but if you have issues that might be the the cause.
I can normally complete these declaration forms but this one is different. I could fill in the fields on the form but the save button is disabled. Tried different browsers, other people tried but in the end only the account owner could do it.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
See my latest blog-post about this
Hi Chris, I see Google Play is again asking for activity recognition declaration even though I have set it to be removed (<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" tools:node="remove" />) for a few months now.
Any idea how to debug this?
android/app/src/main/AndroidManifest.xml
I just tested this on my demo app, adding the following to my AndroidManifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools">
+ <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" tools:node="remove" />
</manifest>
Next, I install a tool to analyze the my app-release.apk
$ wget https://github.com/google/android-classyshark/releases/download/8.2/ClassyShark.jar
$ java -jar ClassyShark.jar -open <app-release.apk>
I see that <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" /> does not exist in my AndroidManifest.xml. For more information on using tools:node="remove", see the Android docs: "Manage Manifest Files"
This is very helpful, Thanks.
I followed the steps and while I do not see android.permission.ACTIVITY_RECOGNITION
I do see the following, should I tools:node="remove" those too?
<uses-permission
name='com.google.android.gms.permission.ACTIVITY_RECOGNITION'>
</uses-permission>
<uses-permission
name='com.huawei.hms.permission.ACTIVITY_RECOGNITION'>
You do not need to worry about those permissions. One is only used by Huawei devices running the HMS operating system and the other is for older versions of Android.
Your warning message from Play Store specifically complains about a permission named android.permission.ACTIVITY_RECOGNITION. Those two permissions are not that.
Resolved. Appreciate your quick response 🙏
If anyone comes across this here, the issue was due to another release track hand an older version with that permission. The 'solution' was to release a new version on that track too, so the request for declaration goes away.
Hi @christocracy
This week I did an update to my app. It's been more than 2 years the app is public. And the app released was rejected. Google complain now about the ACTIVITY_RECOGNITION.
I changed the app content declaration following your blog post
But even with that Google constantly reject my submission. It seems to be automated now, because when I submit, it takes a couple of minutes and I have their response (compare to multiple days before)
Hi all,
I wanted to share a helpful post related to a Google Play rejection issue I faced, which could assist others dealing with similar challenges. After struggling with repeated rejections over the Health Declaration form, I was able to resolve it by removing the "Activity & Fitness" category and clarifying that our app doesn’t provide any health features.
I’ve detailed the steps I took in the following GitHub post, which may be useful for anyone facing similar issues with Google Play’s policies:
How we resolved Google Play rejection
Hope it helps!
this works, add these lines.
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" tools:node="remove" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" tools:node="remove" />