UOK last
UOK last

Reputation: 44

google play says I’m requesting location permission (I’m not)

(Problem is Solved) Hello google are not publishing my app for background location access currently am using these permissions for the current location only and am not using background location access these are the permissions in the manifest file and my Gradle please advice

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

apply plugin: 'com.android.application'

android {
compileSdkVersion 30


defaultConfig {
    applicationId "*****"
    minSdkVersion 17
    targetSdkVersion 30
    versionCode 82
    versionName "26"
    multiDexEnabled true
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
dexOptions {
    javaMaxHeapSize "8g"
}
repositories {
    mavenCentral()
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.wunderlist:sliding-layer:1.2.5'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
implementation 'com.google.firebase:firebase-analytics:18.0.2'
implementation 'com.google.firebase:firebase-crashlytics:17.3.1'
implementation 'com.google.maps:google-maps-services:0.1.20'
implementation 'com.google.android.libraries.places:places:2.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.commit451:PhotoView:1.2.4'
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

After Adding this line not working yet

<uses-permission 
android:name="android.permission.ACCESS_COARSE_LOCATION" 
tools:node="remove"/>

<uses-permission 
android:name="android.permission.ACCESS_BACKGROUND_LOCATION" 
tools:node="remove" />

<uses-permission   
android:name="com.google.android.finsky.permission.
BIND_GET_INSTALL_REFER 
RER_SERVICE" tools:node="remove" />

and this is the merged manifest file data

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

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

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

<uses-feature
    android:glEsVersion="0x20000"
    android:required="true" />

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

<uses-permission
    android:name="com.google.android.c2dm.permission.RECEIVE" />





also this services
<service        
android:name="com.google.android.datatransport.runtime.scheduling.
jobscheduling.JobInfoSchedulerService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false" />

<receiver
android:name="com.google.android.
datatransport.runtime.scheduling.jobscheduling.
AlarmManagerSchedulerBroadcastReceiver"
android:exported="false" />

<provider   
android:name="androidx.lifecycle.
ProcessLifecycleOwnerInitializer"
android:exported="false"
android:multiprocess="true"
android:authorities="com
.dolifecycle-process" 
/>

<service
android:name="com.google.android.datatransport
.runtime.backends.TransportBackendDiscovery"
android:exported="false">

<meta-data android:name="backend:com.google.android.
datatransport.cct.CctBackendFactory"
android:value="cct" />
</service>


<provider
android:name="com.google.firebase.provider
.FirebaseInitProvider"
android:exported="false"
android:authorities="com.firebaseinitprovider"
android:initOrder="100"
android:directBootAware="true" />

<service
android:name="com.google.android.gms.measurement
.AppMeasurementService"


<receiver
android:name="com.google.android.gms.measurement
.AppMeasurementReceiver"

android:name="com.google.android.gms.common.api.GoogleApiActivity"

<receiver
android:name="com.google.firebase.iid.
FirebaseInstanceIdReceiver"

but nothing shows that am using background location service so I uploaded the apk to google play service but I got rejected for the same reason, if there is anything else that I can do help me out thanx

google messages Background location access not declared We detected that your app contains at least one feature that requests access to the location in the background, however, your permission declaration form did not reflect this. Please log in to your Play Console to resubmit your location declaration form. You may either remove the location in the background from your app or indicate that the usage is in the background.

The solution to the problem is:

1- from your project go to gradle-wrapper.properties and change the distributionUrl to

distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip

2- remove any singleton class that access the location check your Application class

3- Show the permission dialog immediately before gitting it

4- add to your manifast file

<uses-permission 
android:name="android.permission.ACCESS_COARSE_LOCATION" 
tools:node="remove" />
<uses-permission 
android:name="android.permission.ACCESS_BACKGROUND_LOCATION" 
tools:node="remove" />

5- change the compileSdkVersion and targetSdkVersion to 30 from build.gradle file

Google console

1- remove any old builds on the testing in my case there were old builds running on 28. SDK so remove them

2- from google console click “App Content”. then "App access" then "All or some functionality is restricted" then "manage" and add the access to your app if its needed one

3- go to “App Content” then "Sensitive app permissions" then "Location permissions" and "Location permissions" and select No from "Does your app access location in the background in APKs or app bundles targeting Android 9 (Pie) or older (SDK level 28 or lower)?"

now submit your build it can take time in my case it took 12 days to be on google play thanx

Upvotes: 1

Views: 2299

Answers (3)

Shaxriyor Xusinov
Shaxriyor Xusinov

Reputation: 121

In my case, I was using implementation "com.mapbox.navigation:android:2.17.0" library, and this lib was requiring FOREGROUND SERVICE LOCATION permission, that's why, my app was getting rejected from play console. Then I added these two lines below to manifest file.

<uses-permission
    android:name="android.permission.FOREGROUND_SERVICE"
    tools:node="remove" />

<uses-permission
    android:name="android.permission.FOREGROUND_SERVICE_LOCATION"
    tools:node="remove" />

Then my app released to the google play store)

Upvotes: 0

Xavier Rubio Jansana
Xavier Rubio Jansana

Reputation: 6583

Either one of these libraries are using it.

implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.libraries.places:places:2.4.0'

You can find out by opening AndroidManifes.xml and using the "Merged Manifest" tab at the bottom of this editor. Locate the permission and you will be able to see who is including it by selecting it.

BTW you can remove it from your manifest if you don't need it by using:

<uses-permission
     android:name="android.permission.ACCESS_BACKGROUND_LOCATION"
     tools:node="remove" />

Upvotes: 2

C B J
C B J

Reputation: 1868

Sometimes permissions can be "brought in" from other libraries (in your dependencies) via the manifest merger.. essentially because a library you are using needs that permission, it gets added automatically.

Try using the "aapt" command line tool to list the permissions requested by your application see aapt command line description.

you probably want "aapt2 dump permissions"

then try looking through your app build folder for the merged manifest files to try and find clues as to where it might have come from.

Upvotes: 0

Related Questions