Google PlayStore reject app due to accessing the location in the background

Any updates here?

Assuming you’re using SDK 39 or SDK 40, the above will not request background location permissions.
Just be sure you don’t have another version of the app (e.g. for internal testing) that is requesting background location permissions.

But to be sure that the APK you’re trying to upload does not request background location permissions, see @notbrent’s answer. In particular the aapt2 d permissions path/to/app.apk command.

1 Like

Any update ?

With SDK 40, will it request background location if I have these?

"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION"

Also having this problem. I noticed that the App Policy flag for “Sensitive app permissions” is flagging a MUCH older APK that requested background location permissions. Have tried to get Google to review the current APK. Will update this when I hear back from them.

No, only if you include ACCESS_BACKGROUND_LOCATION

1 Like

UPDATE: This seemed to be the problem for me. Check you don’t have a release track with an old APK using background location permissions on it. I also had to do ‘expo publish’ as I was getting some odd SDK25 errors.

2 Likes
  • you using managed or bare app? managed
  • What SDK version do you use? SDK 40
  • What packages do you use? (e.g. list your package.json)
{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@expo/react-native-action-sheet": "^3.8.0",
    "@expo/vector-icons": "^12.0.0",
    "@react-native-community/async-storage": "~1.12.0",
    "@react-native-community/checkbox": "^0.5.5",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "5.9.7",
    "@react-native-community/picker": "1.6.6",
    "@react-native-community/viewpager": "4.2.0",
    "@react-navigation/bottom-tabs": "^5.10.2",
    "@react-navigation/drawer": "^5.10.2",
    "@react-navigation/material-top-tabs": "5.2.16",
    "@react-navigation/native": "^5.8.2",
    "@react-navigation/stack": "^5.11.1",
    "axios": "^0.20.0",
    "debounce": "^1.2.0",
    "expo": "^40.0.0",
    "expo-app-loading": "^1.0.1",
    "expo-asset": "~8.2.1",
    "expo-av": "~8.7.0",
    "expo-background-fetch": "~8.6.0",
    "expo-barcode-scanner": "~9.1.0",
    "expo-blur": "~8.2.2",
    "expo-brightness": "~8.4.0",
    "expo-camera": "~9.1.0",
    "expo-contacts": "~8.6.0",
    "expo-device": "~2.4.0",
    "expo-file-system": "~9.3.0",
    "expo-font": "~8.4.0",
    "expo-linear-gradient": "~8.4.0",
    "expo-location": "~10.0.0",
    "expo-media-library": "~10.0.0",
    "expo-network": "~2.4.0",
    "expo-notifications": "~0.8.2",
    "expo-permissions": "~10.0.0",
    "expo-screen-capture": "^1.1.1",
    "expo-sms": "~8.4.0",
    "expo-splash-screen": "~0.8.1",
    "expo-sqlite": "~8.5.0",
    "expo-status-bar": "~1.0.3",
    "expo-task-manager": "~8.6.0",
    "expo-updates": "~0.4.1",
    "expo-video-player": "^1.6.1",
    "expo-video-thumbnails": "~4.4.0",
    "expo-web-browser": "~8.6.0",
    "fiction-expo-restart": "^1.0.5",
    "formik": "^2.2.1",
    "jsbarcode": "^3.11.3",
    "lodash": "^4.17.20",
    "lottie-ios": "3.1.8",
    "lottie-react-native": "~2.6.1",
    "moment": "^2.29.1",
    "prop-types": "^15.7.2",
    "query-string": "^6.13.6",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
    "react-native-animatable": "^1.3.3",
    "react-native-appearance": "~0.3.3",
    "react-native-auto-height-image": "^3.2.3",
    "react-native-autoheight-webview": "^1.5.4",
    "react-native-elements": "^2.3.2",
    "react-native-expo-image-cache": "^4.1.0",
    "react-native-extended-stylesheet": "^0.12.0",
    "react-native-gesture-handler": "~1.8.0",
    "react-native-image-gallery": "^2.1.5",
    "react-native-image-slider": "^2.0.3",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-modal": "^11.5.6",
    "react-native-qrcode-svg": "^6.0.6",
    "react-native-reanimated": "~1.13.0",
    "react-native-safe-area-context": "3.1.9",
    "react-native-screens": "~2.15.2",
    "react-native-scrollable-tab-view": "^1.0.0",
    "react-native-svg": "12.1.0",
    "react-native-tab-view": "2.15.1",
    "react-native-vector-icons": "^7.1.0",
    "react-native-web": "~0.13.12",
    "react-native-webview": "11.0.0",
    "react-navigation": "^4.4.3",
    "react-navigation-drawer": "^2.6.0",
    "react-navigation-header-buttons": "5.0.2",
    "react-redux": "^7.2.2",
    "react-refresh": "^0.9.0",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0",
    "styled-components": "^5.2.1",
    "urijs": "^1.19.2"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "@babel/plugin-syntax-class-properties": "^7.12.1",
    "@babel/runtime": "^7.12.1",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.1",
    "babel-plugin-module-resolver": "^4.0.0",
    "babel-preset-expo": "8.3.0",
    "jest": "^26.6.1"
  },
  "private": true,
  "jest": {
    "preset": "react-native"
  }
}

  • What is the output of aapt2 d permissions path/to/app.apk (See this installation/usage guide] of aapt2)
aapt2 d permissions hanaro-plus-3a07a939a86e4c75823c5057b3d69750-signed.apk
permission: com.hanaroPlus.hanaroPlus.permission.C2D_MESSAGE
uses-permission: name='com.hanaroPlus.hanaroPlus.permission.C2D_MESSAGE'
uses-permission: name='com.google.android.c2dm.permission.RECEIVE'
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
uses-permission: name='android.permission.INTERNET'
uses-permission: name='android.permission.SYSTEM_ALERT_WINDOW'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='android.permission.CAMERA'
uses-permission: name='android.permission.FOREGROUND_SERVICE'
uses-permission: name='android.permission.ACCESS_COARSE_LOCATION'
uses-permission: name='android.permission.ACCESS_FINE_LOCATION'
uses-permission: name='android.permission.READ_EXTERNAL_STORAGE'
uses-permission: name='android.permission.READ_INTERNAL_STORAGE'
uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'
uses-permission: name='host.exp.exponent.permission.C2D_MESSAGE'
uses-permission: name='android.permission.MODIFY_AUDIO_SETTINGS'
uses-permission: name='android.permission.ACCESS_WIFI_STATE'
uses-permission: name='android.permission.RECEIVE_BOOT_COMPLETED'
uses-permission: name='com.sonymobile.home.permission.PROVIDER_INSERT_BADGE'
uses-permission: name='com.huawei.android.launcher.permission.CHANGE_BADGE'
uses-permission: name='com.huawei.android.launcher.permission.READ_SETTINGS'
uses-permission: name='com.huawei.android.launcher.permission.WRITE_SETTINGS'
uses-permission: name='android.permission.READ_APP_BADGE'
uses-permission: name='com.oppo.launcher.permission.READ_SETTINGS'
uses-permission: name='com.oppo.launcher.permission.WRITE_SETTINGS'
uses-permission: name='me.everything.badger.permission.BADGE_COUNT_READ'
uses-permission: name='me.everything.badger.permission.BADGE_COUNT_WRITE'
uses-permission: name='com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE'
  • What is the name of your app (e.g. @acme/app)
    @nonghyupmart/hanaro-plus

I still get rejected from GooglePlay Store due to accessing location in background.

As you can see from the aapt2 output, your app does not require android.permission.ACCESS_BACKGROUND_LOCATION. So the problem is not with this version of your app.

Perhaps you have an old version of the app (e.g. an internal testing version) that is still referencing the ACCESS_BACKGROUND_LOCATION permission?

if you’re encountering this issue please refer to this thread for more info: Android app rejected because of background location · Issue #11918 · expo/expo · GitHub

Just as a record in case it will give some of you an insight, I had the same issue with several apps, built with SDK38, even though my android.permissions on app.json was set to an empty array [].
It appears that some changes were made to the SDK(s) after their first release, so I re-built the apps, without changing anything in the app.json file, except for ios bundle number and android version code, and the permission for background location wasn’t there anymore. After this, I submitted the app bundle to Google Play and it was approved without issues.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.