1. Are you ready for the Galaxy S20? Here is everything we know so far!

How do I find if I have background location services? I only use ACCESS_FINE_LOCATION foreground

Discussion in 'Android Development' started by Night Knight, Mar 1, 2021.

  1. Night Knight

    Night Knight Lurker
    Thread Starter

    I'm currently struggling with being compliant with new google play policies regarding localization permission.

    I developed an app to call emergency numbers from (almost) any country in the world and I have a feature that allows the user to click on a button to locate himself and display the corresponding emergency numbers of the country he is in.

    My issue is that Google sent me an email to reject my app because I quote : "Feature does not meet requirements for background location access".
    The thing is : I do not ask for background location access, so I do not know what to do... I ask for "ACCESS_FINE_LOCATION" and I start a service declared as foreground.

    Here is my manifest :

    Code (Text):
    1.  
    2.     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    3.     <uses-permission android:name="android.permission.CALL_PHONE" />
    4.  
    5.     <application
    6.         android:allowBackup="true"
    7.         android:icon="@drawable/er"
    8.         android:label="@string/app_name"
    9.         android:roundIcon="@drawable/er"
    10.         android:supportsRtl="true"
    11.         android:theme="@style/AppTheme"
    12.         android:windowSoftInputMode="adjustPan"
    13.         android:screenOrientation="portrait">
    14.  
    15.         <service
    16.             android:name=".LocationService"
    17.             android:enabled="true"
    18.             android:description="@string/emergency_localization"
    19.             android:foregroundServiceType="location"
    20.             android:icon="@drawable/er"
    21.             android:label="@string/emergency_localization_label"
    22.             android:permission="android.permission.FOREGROUND_SERVICE"/>
    23.  
    24.         <activity android:name=".MainActivity">
    25.             <intent-filter>
    26.                 <action android:name="android.intent.action.MAIN" />
    27.                 <category android:name="android.intent.category.LAUNCHER" />
    28.             </intent-filter>
    29.         </activity>
    30.     </application>
    31.  
    32.     <uses-feature
    33.         android:name="android.location.Geocoder"
    34.         android:required="false" />
    35.  
    And the code plugged to the localization button :

    Code (Text):
    1.  
    2.             findMeBtn.setOnClickListener(v -> {
    3.             if (!PermissionNeeded()) {
    4.                 DisplayIcon(true);
    5.                 locationIntent = new Intent(getApplicationContext(), LocationService.class);
    6.                 startService((locationIntent));
    7.             }
    8.         });
    9.  
    I asked for more information to Google, and the only answer was :

    "We have re-reviewed your app, but your declared feature still does not meet the requirements to access location in the background because of the following reason(s):

    Users may not expect the app to access their location in the background
    It is possible to deliver a similar experience without access to location in the background"

    Thank you very much Google for being more explicit...

    I saw afterwards that I was not stoping the service in the onPause method in the main activity, so I added this and tried to publish it again, but same error, apparently I am still asking a background service permission, without currently asking it ...

    Code (Text):
    1.  
    2. @Override
    3. public void onPause() {
    4.     super.onPause();
    5.     if (locationIntent != null) stopService(locationIntent);
    6. }
    7.  
    8. @Override
    9. public void onDestroy() {
    10.     super.onDestroy();
    11.     unregisterReceiver(broadcastReceiver);
    12.     if (locationIntent != null) stopService(locationIntent);
    13. }
    14.  
    So I'm pretty sure I'm missing something obvious somewhere, but since I have no idea where to look at, I really need a new pair of eyes on it... I am now losing faith on this app's future...

    Thanks a lot by advance !
     


    #1 Night Knight, Mar 1, 2021
    Last edited: Mar 5, 2021

    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...