Android Question Background location access not declared

Filippo

Expert
Licensed User
Hi,

my app was not approved by google because of this policy (see thread title) .
Issue with your app​
We found the following issue(s) with your app:

Eligibility Issue
Background location access not declared
We detected that your app contains at least one feature that requests background location access, however you have not submitted a permission declaration form for this feature. Please log in to your Play Console and submit a declaration form.

Affected APK(s):
APK:64
Reasons of violation
About the Permissions & Location Permissions policies​
You may only request permissions that are necessary to implement critical current features or services in your application. You may not use permissions that give access to user or device data for undisclosed, unimplemented, or disallowed features or purposes. In order for our team to check for compliance, we must be able to review and verify your in-app experience.
Publishing Status
App status: Rejected​
Your app has been rejected and wasn't published due to this policy issue. If you submitted an update, the previous version of your app is still available on Google Play.

But I am not aware that where I need background location access.
This is the app manifest:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="29"/>
<uses-feature android:name="android.hardware.location.gps"/>
<supports-screens android:xlargeScreens="true"
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="false"
    android:anyDensity="true" />)
    'android:requiresSmallestWidthDp="500"
'SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:largeHeap, "true")
'Neu ab SDK-29
SetApplicationAttribute(android:requestLegacyExternalStorage, true)
'End of default text.


'Einstellung für Adaptive-icon
SetApplicationAttribute(android:icon, "@mipmap/ic_launcher")
CreateResource(mipmap-anydpi-v26, ic_launcher.xml,
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/background"/>
    <foreground android:drawable="@mipmap/foreground"/>
</adaptive-icon>
)

AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(android.permission.WRITE_SETTINGS)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_PHONE_STATE)

'************ AppCompat components ************
SetApplicationAttribute(android:theme, "@style/MyAppTheme")
CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#607D8B</item>
        <item name="colorPrimaryDark">#455A64</item>
        <item name="colorAccent">#607D8B</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
    </style>
</resources>
)

'************ Required for Maps ************
AddApplicationText(
<meta-data
  android:name="com.google.android.geo.API_KEY"
  android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
)
AddApplicationText(
<uses-library
      android:name="org.apache.http.legacy"
      android:required="false" />
)
'End of Required for Maps

'************ Crashlytics components ************
'Google Play Services Base - Always required when using Google Play Services or Firebase:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)

'Firebase Analytics
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)

'Crashlytics components
CreateResourceFromFile(Macro, FirebaseAnalytics.Crashlytics)
'End of Crashlytics components

'GooglePlayBilling - In App Purchases
CreateResourceFromFile(Macro, GooglePlayBilling.GooglePlayBilling)
'End of GooglePlayBilling

'************ File Provider ****************
'E-Mail senden ab Android 6+
AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="" />
)
'Ende of File Provider

and these are the permission:
<permission android:name="fg.MasterOfRegolarity.permission.C2D_MESSAGE"
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="com.android.vending.BILLING"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="fg.MasterOfRegolarity.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="fg.MasterOfRegolarity.permission.C2D_MESSAGE"/>
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE"/>

and this is my code with which I ask the permission:
B4X:
Private Sub CheckAndRequestPermission
    If Not(Starter.rp.Check( Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)) Then
        Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
    End If

    If Not(Starter.rp.Check( Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)) Then
        Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    End If
End Sub

Sub Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result = False Then
        Select Permission
            Case Starter.rp.PERMISSION_ACCESS_FINE_LOCATION
                Msgbox2Async(Starter.Language.Value("ACCESS_FINE_LOCATION"), Starter.Language.Value("PermissionDenied"), "OK","","",Null, False)

            Case Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE
                Msgbox2Async(Starter.Language.Value("WRITE_EXTERNAL_STORAGE"), Starter.Language.Value("PermissionDenied"), "OK","","",Null, False)
        End Select
    End If
End Sub

In Main->Activity_Resume is this code :
B4X:
Sub Activity_Resume
...
    If Starter.rp.Check( Starter.rp.PERMISSION_ACCESS_FINE_LOCATION) Then
        If Not(Starter.GPS1.GPSEnabled) Then
            ToastMessageShow(Starter.language.value("msgEnableGpsDevice"), True)
            StartActivity(Starter.GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
        Else
            CallSub(Starter, "StartGPSAndTimer")
        End If
    End If
...
End Sub

and in Starter-Service:
B4X:
Sub Service_Create
...
    GPS1.Initialize("GPS1")
    GPSPathPreviuous.Initialize
...
End Sub

Public Sub StartGPSAndTimer
    If Not(GPS_On) Then
        GPS1.Start(GPSMinTime, GPSMinDistance) 'Listen to GPS with no filters.
        GPS_On = True
    End If
End Sub

I don't know what to change now.
 

Filippo

Expert
Licensed User
I don't see any significant difference between the two lists.

The 'fine location' is listed in both cases.
Thanks Erel!
I also don't understand what Google wants, sometimes everything is OK, and sometimes it's no more.
I sent an email to Google on Friday, now I have to wait what they say.
 
Upvote 0

Filippo

Expert
Licensed User
That's the current answer from Google.
As you can see from my app permission (see post # 20), the "ACCESS_BACKGROUND_LOCATION" permission is not asked.
How should I delete this permission if I don't know where it is?
Issue with your app​
Unclear feature description
We were unable to identify the feature that requires access to location in the background based on the declaration you submitted. Please resubmit a declaration with a clear description or additional information regarding the one feature that requires access to location in the background. Even if your app has multiple features that require access to location in the background, please only select one feature and resubmit your declaration form.

When selecting one feature, please note the following:
  • Your selected feature should deliver clear value to the user and be important to the core functionality, or main purpose of the app. Without this core feature, the app is “broken” or rendered unusable.
  • You should also consider if users would expect the app to access their location in the background, and if you can deliver the same experience without accessing location in the background.
  • Since your app does not need background location, please request to remove background usage and reach compliance:
    • For any APKs 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)
      • You should no longer see the Location declaration listed under App Content
    • For any APKs 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)
      • 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?”
Please note that access to location in the background solely for the purpose of ads will be denied.
 
Upvote 0

Filippo

Expert
Licensed User
These permissions are displayed in the Google console:
1608728030352.png

android.permission.ACCESS_COARSE_LOCATION,
android.permission.ACCESS_FINE_LOCATION,
android.permission.ACCESS_NETWORK_STATE,
android.permission.BLUETOOTH,
android.permission.BLUETOOTH_ADMIN,
android.permission.FOREGROUND_SERVICE,
android.permission.INTERNET,
android.permission.READ_EXTERNAL_STORAGE,
android.permission.READ_PHONE_STATE,
android.permission.VIBRATE,
android.permission.WAKE_LOCK,
android.permission.WRITE_EXTERNAL_STORAGE,
android.permission.WRITE_SETTINGS,
com.android.vending.BILLING,
com.google.android.c2dm.permission.RECEIVE,
com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE,
com.google.android.providers.gsf.permission.READ_GSERVICES,
fg.MasterOfRegolarity.permission.C2D_MESSAGE,
fg.MasterOfRegolarity.permission.MAPS_RECEIVE

and that is the content of AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="fg.MasterOfRegolarity"
android:versionCode="71"
android:versionName="3.20.6"
android:installLocation="internalOnly">

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="29"/>
<uses-feature android:name="android.hardware.location.gps"/>
<supports-screens android:xlargeScreens="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:anyDensity="true" />
<permission android:name="fg.MasterOfRegolarity.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="com.android.vending.BILLING"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="fg.MasterOfRegolarity.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="fg.MasterOfRegolarity.permission.C2D_MESSAGE"/>
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE"/>
<application
android:label="MoR"
android:largeHeap="true"
android:requestLegacyExternalStorage="true"
android:icon="@mipmap/ic_launcher"
android:theme="@style/MyAppTheme">

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<activity android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true"
android:exported="false" >
</receiver>

<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false" />

<receiver
android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
android:enabled="true"
android:exported="true"
android:permission="android.permission.INSTALL_PACKAGES" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementJobService"
android:enabled="true"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />

<service android:name="com.google.firebase.components.ComponentDiscoveryService" android:directBootAware="true" >
<meta-data
android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.storage.StorageRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.firestore.FirestoreRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar"/>

<meta-data
android:name="com.google.firebase.components:com.google.firebase.database.DatabaseRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data
android:name="com.google.firebase.components:com.google.firebase.messaging.FirebaseMessagingRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.crashlytics.CrashlyticsRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />

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

<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="fg.MasterOfRegolarity" />
</intent-filter>
</receiver>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />


<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
android:exported="true">
<intent-filter android:priority="-500">
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<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>
<service
android:name="com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" >
</service>

<receiver
android:name="com.google.android.datatransport.runtime.scheduling.jobscheduling.AlarmManagerSchedulerBroadcastReceiver"
android:exported="false" />
<meta-data
android:name="com.google.android.play.billingclient.version"
android:value="2.0.3" />

<activity
android:name="com.android.billingclient.api.ProxyBillingActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="fg.MasterOfRegolarity.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".main"
android:label="MoR"
android:screenOrientation="sensorLandscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".minputtimer"
android:label="MoR"
android:screenOrientation="sensorLandscape">
</activity>
<service android:name=".starter">
</service>
<receiver android:name=".starter$starter_BR">
</receiver>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".mshowstoredresults"
android:label="MoR"
android:screenOrientation="sensorLandscape">
</activity>
<service android:name=".smmaster">
</service>
<receiver android:name=".smmaster$smmaster_BR">

<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>
<action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"/>
</intent-filter>
</receiver>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".mgooglemape"
android:label="MoR"
android:screenOrientation="sensorLandscape">
</activity>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".metallonage"
android:label="MoR"
android:screenOrientation="sensorLandscape">
</activity>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".mpreferencemenu"
android:label="MoR"
android:screenOrientation="sensorLandscape">
</activity>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".mshowsavedrace"
android:label="MoR"
android:screenOrientation="sensorLandscape">
</activity>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".msincronize"
android:label="MoR"
android:screenOrientation="sensorLandscape">
</activity>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".mtraningtable"
android:label="MoR"
android:screenOrientation="sensorLandscape">
</activity>
<service android:name=".smatomtime">
</service>
<receiver android:name=".smatomtime$smatomtime_BR">
</receiver>
<service android:name=".httputils2service">
</service>
<receiver android:name=".httputils2service$httputils2service_BR">
</receiver>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name="fg.PreferenceMenu.testactivity"
android:label="MoR"
android:screenOrientation="sensorLandscape">
</activity>
</application>
</manifest>
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
The background permission is not there.
Show them the screenshot with the list of permissions. It looks like a mistake.

This is what Google documentation says about the permission:
  • If you don't need location access in the background, remove it.
    If your app targets Android 10 (API level 29) or higher, remove the ACCESS_BACKGROUND_LOCATION permission from your app's manifest. When you remove this permission, all-the-time access to location isn't an option for the app on devices that run Android 10.
Maybe the answer is here: "please request to remove background usage and reach compliance".
 
Upvote 0

Filippo

Expert
Licensed User
Hi Erel,
Unfortunately I can write whatever I want to Google, Google doesn't understand anything, it's like speaking against a wall.
You just get an automated response and that's it.
I've already sent the permission list, it didn't matter, they don't want to understand.
 
Upvote 0

Filippo

Expert
Licensed User
After I made this setting, the app update was approved by Google.
As I understood it, is it possible that the app can be removed from Google?
1608811922144.png
 
Upvote 0

Filippo

Expert
Licensed User
Only Google can answer such question, especially as I don't know German...
Should I translate this text into Italian for you? ;)
just kidding.
I have to wait again what the support writes.
 
Upvote 0

Filippo

Expert
Licensed User
Hi,

Yesterday I had the option “Does your app access location in the background in APKs or app bundles targeting Android 9 or older?” applied and the app was approved.
I didn't understand why, but maybe you don't always have to understand everything. :rolleyes:

How do I remove location in the background?

If you have determined that your app does not require location in the background, complete the following steps to remove background usage and reach compliance. Please note that you will need to submit your app for review if the following permissions are used in any APKs, including non-production tracks. You can find a listing of impacted APKs in Play Console on the App content page (Policy > App content > Sensitive App Permissions > Show Summary):

  • If 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)
    • You should no longer see the Location declaration listed under App Content
  • If 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)
    • In your Play 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?”
 
Upvote 0
Top