android react-native避免“未声明后台位置访问"在 Google 审批流程中 [英] android react-native avoiding "Background location access not declared" in Google approval process

查看:93
本文介绍了android react-native避免“未声明后台位置访问"在 Google 审批流程中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以 Google 告诉我们未声明后台位置访问权限"并且不让我们发布我们的应用程序.我们没有使用背景位置,所以我们试图完全消除它.

Okay, so Google is telling us "Background location access not declared" and not letting us publish our app. We have no use for background location, so we're trying to elimiate it completely.

当然我的清单没有它:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="com.android.vending.BILLING" />
    <uses-feature android:name="android.hardware.location.gps"/>

我在任何地方都搜索过任何可能将 ACCESS_BACKGROUND_LOCATION 添加到我们的应用程序的内容,但一无所获.

I've searched absolutely everywhere for anything that could be adding ACCESS_BACKGROUND_LOCATION to our app, and found nothing.

使用银搜索器:

ag ACCESS_BACKGROUND_LOCATION .

我已经检查了责备报告以寻找线索,并在任何带有背景"一词的情况下向后工作,但无济于事:android/app/build/intermediates/manifest_merge_blame_file/myAppRelease/manifest-merger-blame-myapp-release-report.txt

I've exampined the blame report for a clue, and worked backwards on anything with the word 'background', to no avail: android/app/build/intermediates/manifest_merge_blame_file/myAppRelease/manifest-merger-blame-myapp-release-report.txt

不过我确实找到了一些额外的权限:

I did find some extra permissions though:

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

但我在那里没有看到任何危险信号..

But I don't see any red flags there..

我已经尝试了节点删除选项:

I've tried the node remove option:

<manifest ...xmlns:tools="http://schemas.android.com/tools"...>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="remove" />

但没什么.

我也运行了 aapt2

I've also run aapt2

$ aapt2 d permissions android/app/build/outputs/apk/myapp/release/app-myapp-release.apk
package: com.myapp
uses-permission: name='android.permission.INTERNET'
uses-permission: name='android.permission.ACCESS_COARSE_LOCATION'
uses-permission: name='android.permission.ACCESS_FINE_LOCATION'
uses-permission: name='android.permission.SYSTEM_ALERT_WINDOW'
uses-permission: name='com.android.vending.BILLING'
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
uses-permission: name='android.permission.ACCESS_WIFI_STATE'
uses-permission: name='android.permission.WAKE_LOCK'

这并没有告诉我更多..

Which doesn't tell me much more..

我还观看了谷歌发布的关于背景位置的整个 YouTube 视频,阅读了官方文档,并检查了每个堆栈溢出帖子 - 但他们只是推荐我已经采取的步骤.

I've also watched the whole youtube video google posted regarding background positions, read the official docs, and checked every stack overflow post on this - but they just recommend the steps I've already taken.

这是一个令人筋疲力尽的过程!我累极了.我最好的猜测是我们的依赖项是问题之一,但我没有很好的线索来确定它可能是哪一个.

It's an exhausting process! I'm exhausted. My best guess is that one our dependencies is the problem, but I have no good clues as to which one it could be.

真的很感激一些新鲜的眼睛..也许有人用下面的这些包之一遇到过这种情况,并且会像,就是这样!删除它!

Would really appreciate some fresh eyes.. maybe someones encountered this with one of these packages below and is just going to be like, that's the one! Delete it!

否则它会回到绝望的搜索和基于最少信息的蛮力重建..

Otherwise it's back to desperate searching and brute force rebuilds on minimal information..

  "dependencies": {
    "@mapbox/geo-viewport": "0.4.1",
    "@mapbox/geojson-extent": "0.3.2",
    "@mapbox/polyline": "1.1.1",
    "@ptomasroos/react-native-multi-slider": "1.0.0",
    "@react-native-community/async-storage": "1.12.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "4.7.0",
    "@react-native-mapbox-gl/maps": "7.0.8",
    "@sentry/react-native": "1.8.2",
    "@turf/along": "^6.0.1",
    "@turf/bearing": "^6.0.1",
    "@turf/distance": "^6.0.1",
    "@turf/helpers": "^6.1.4",
    "@turf/line-distance": "^4.7.3",
    "@turf/nearest": "^4.7.3",
    "check-node-version": "4.0.3",
    "deprecated-react-native-listview": "^0.0.6",
    "eslint-plugin-react": "7.21.2",
    "install": "^0.13.0",
    "npm": "6.14.8",
    "prop-types": "^15.6.0",
    "react": "16.11.0",
    "react-native": "0.62.2",
    "react-native-billing": "^3.0.0",
    "react-native-config": "^1.4.2",
    "react-native-elements": "^1.2.7",
    "react-native-gesture-handler": "1.8.0",
    "react-native-in-app-utils": "6.1.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-mixpanel": "1.2.5",
    "react-native-rate": "1.0.9",
    "react-native-safe-area-context": "^3.1.8",
    "react-native-screens": "2.8.0",
    "react-native-splash-screen": "3.2.0",
    "react-native-sqlite-2": "1.7.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "10.9.3",
    "react-navigation": "4.0.10",
    "react-navigation-stack": "2.0.16",
    "url": "^0.11.0",
    "util": "0.12.3",
    "which-polygon": "2.2.0"
  },
  "devDependencies": {
    "babel-eslint": "^10.1.0",
    "eslint": "^6.8.0",
    "eslint-plugin-import": "2.22.1",
    "fs-extra": "^8.1.0",
    "jetifier": "1.6.6",
    "metro-react-native-babel-preset": "^0.58.0",
    "minimatch": "^3.0.4",
    "node-watch": "0.6.4",
    "rimraf": "2.7.1"
  }

希望右眼能看到这一点,或者能指出一些东西..谢谢!

Hopefully the right eyes sees this, or can point to something.. Thanks!

更新,从谷歌获得更多细节:

Update, got some more details from google:

由于您的应用不需要后台位置,请请求删除后台使用并达到合规性:

Since your app does not need background location, please request to remove background usage and reach compliance:

如果您的目标是 Android 10 或更高版本(SDK 级别 29 或更高):从您的应用 APK 中删除 ACCESS_BACKGROUND_LOCATION 权限或应用程序包.如果您使用 ACCESS_COARSE_LOCATION 或ACCESS_FINE_LOCATION,检查您的代码路径并将使用限制为仅用于前景.(学到更多:https://developer.android.com/training/location/background) 你应该不再看到 App 下控制台中列出的位置声明内容.如果您的目标是 Android 9 或更早版本(SDK 级别 28 或更低):如果您已经在使用 ACCESS_COARSE_LOCATION 或ACCESS_FINE_LOCATION,检查您的代码路径并将使用限制为仅用于前景.(学到更多:https://developer.android.com/training/location/background) 在您的控制台声明,对问题您的应用程序是否访问在面向 Android 9 的 APK 或 app bundle 中的后台位置或更老?

If you are targeting Android 10 or newer (SDK level 29 or higher): Remove the ACCESS_BACKGROUND_LOCATION permission from your app APK or app bundle. If you’re using ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION, examine your code paths and restrict usage to foreground purposes only. (learn more: https://developer.android.com/training/location/background) You should no longer see the Location declaration listed in console under App Content. If your are targeting Android 9 or older (SDK level 28 or lower): If you’re already using ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION, examine your code paths and restrict usage to foreground purposes only. (learn more: https://developer.android.com/training/location/background) In your console declaration, select "No" to the question "Does your app access location in the background in APKs or app bundles targeting Android 9 or older?

推荐答案

时间会证明这是否是真正的修复,但我想我会与其他陷入困境的开发人员分享.

Time will tell if this is an actual fix, but I figured I'd share it with other struggling devs.

Google 批准了我们的两个应用!他们批准了我们的 1 个应用程序,因为我们只是崩溃并告诉他们我们使用后台位置,即使我们没有.不是一个令人满意的答案!

Google approved both of our apps! 1 of our apps they approved because we just crumbled and told them we use background location, even though we don't. Not a satisfying answer!

另一个应用程序,我只是构建文件夹并重新提交,他们接受了.因此,这指出最后一个上传者的缓存是问题的潜在来源.虽然我有点期待 Google 会在 2 周内下架该应用,但我们拭目以待.

The other app, I just build folder and resubmitted and they accepted it. So this points at the cache of the last uploader as the potential source of the problem. Though I am half expecting Google to take down the app in 2 weeks, we'll see.

以下是我为那些不确定缓存是否是问题根源的开发者清除缓存的所有笔记:

Here's all my notes on clearing cache for devs who find themselves unsure if the cache is the root of the problem:

清除项目内部缓存

rm android/build
rm ios/build
rm -rf android/.gradle
./gradlew clean

清除电脑缓存

rm -rf ~/.gradle/caches

其他 ios 缓存(当你真的很绝望时)

Other ios caches (For when you're really desperate)

~/Library/Caches/CocoaPods
~/Library/Developer/Xcode/DerivedData/*
~/Library/Developer/Xcode/Archives/*

这当然让人想起一句古老的格言:

Which of course brings to mind the old adage:

如有疑问 - 可能是缓存问题.

这篇关于android react-native避免“未声明后台位置访问"在 Google 审批流程中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆