transistorsoft / capacitor-background-geolocation

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
MIT License
92 stars 16 forks source link

Google asks me to clarify the use of USE_EXACT_ALARM #263

Closed loic-parent closed 1 month ago

loic-parent commented 1 month ago

Your Environment

Latest Dependencies:

@capacitor/cli: 6.1.0 @capacitor/core: 6.1.0 @capacitor/android: 6.1.0 @capacitor/ios: 6.1.0

Installed Dependencies:

@capacitor/cli: 5.2.2 @capacitor/core: 5.2.2 @capacitor/android: 5.2.2 @capacitor/ios: 5.2.2

[success] iOS looking great! 👌 [success] Android looking great! 👌

* Plugin config provided to `#ready`:
```javascript
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 10,
stopTimeout: 5,
debug: false,
logLevel: BackgroundGeolocation.LOG_LEVEL_OFF,
stopOnTerminate: true,
startOnBoot: false,
locationAuthorizationRequest: 'WhenInUse'

Expected Behavior

Send application to Play Store without define my application as a calendar or an alarm.

Actual Behavior

Hi Chris, When I try to send my release to the Google Play Store Checking, I get an error with the declarations. I have to define the declaration for the use of the permission "USE_EXACT_ALARM". I don't use it and I didn't define it in the file AndroidManifest.xml. At the moment, I only have the ability to define my application goal as a calendar or an alarm. Could you help me to understand it and to send my new release without declaring wrong things.

Steps to Reproduce

Nothing to show.

Context

I try to send my new release in the Play Store.

Debug logs

Nothing to show.

christocracy commented 1 month ago

Plugin version: ^5.4.0

This permission was removed over a year ago from the plug-in. Show me your AndroidManifest and upgrade to the latest version. See the CHANGELOG.

loic-parent commented 1 month ago

Hello, Thanks for your reply :)

I just try with the latest 5.x version (I will upgrade to Capacitor 6 in the next few weeks, I can't now) but I get the same error/warning.

"@transistorsoft/capacitor-background-fetch": "^5.2.5",
"@transistorsoft/capacitor-background-geolocation": "^5.4.2",

Here is my AndroidManifest: Do you see something wrong?

<?xml version="1.0" encoding="utf-8" ?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.app.my">
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        android:hardwareAccelerated="true">
        <meta-data
            android:name="com.transistorsoft.locationmanager.license"
            android:value="MY-LICENCE"
        />
        <meta-data
            android:name="com.transistorsoft.locationmanager.hms.license"
            android:value="MY-LICENCE"
        />

        <activity
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
            android:name="com.app.my.MainActivity"
            android:label="@string/title_activity_main"
            android:theme="@style/AppTheme.NoActionBarLaunch"
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:host="com.app.my" />
                <data android:scheme="https" />
            </intent-filter>
        </activity>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
        </provider>
    </application>

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

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature android:name="android.hardware.location.gps" />

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

    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-permission android:name="android.permission.CAMERA" />

    <queries>
        <package android:name="com.waze" />
        <package android:name="com.google.android.apps.maps" />
    </queries>

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

    <uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
loic-parent commented 1 month ago

Hello @christocracy,

Do you see something wrong in my AndroidManifest?

christocracy commented 1 month ago

Do you see something wrong in my AndroidManifest?

No. Now upgrade to the latest version. See the CHANGELOG.

loic-parent commented 1 month ago

This is the latest version compatible with Capacitor v5.

"@transistorsoft/capacitor-background-fetch": "^5.2.5",
"@transistorsoft/capacitor-background-geolocation": "^5.4.2",
christocracy commented 1 month ago

That version contains the problematic permission. Update to v6.

loic-parent commented 1 month ago

Oh ok … I will upgrade it but I planned to publish the app today and if I have to upgrade to v6, I have to upgrade also all the packages to v6 and check for compatibility (adapt if not compatible and so on).

I scheduled this upgrade after this publish. There is no way to fix it in the v5?

christocracy commented 1 month ago

You can provide manual overrides in your AndroidManifest using tools:node="remove"

<manifest>
  <uses-permission
    android:name="android.permission.PERMISSION_NAME_TO_REMOVE"
    tools:node="remove" />
  .
  .
  . 
</manifest>
loic-parent commented 1 month ago

Thank you for the code. I already tried this but the error stay when I try to publish 😕

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

error-1 error-2

christocracy commented 1 month ago

I have no idea.

loic-parent commented 1 month ago

Ok, I will check and if I can't fix it using v5 switch to v6 earlier than scheduled.

However, thank you for your help :)

YasserRabee commented 1 month ago

I have the same issue.

@loic-parent have you got any luck or workaround?

loic-parent commented 1 month ago

Hello @YasserRabee,

No, I haven't found any fix for the moment.

I will upgrade to Capacitor v6 this week and retry after. I'll let you know when I can send without this error 😉

YasserRabee commented 1 month ago

@loic-parent I'm already using cap v6 but the same problem exist. -_-

loic-parent commented 1 month ago

@YasserRabee Oh ok 😕. Perhaps @christocracy can help us to identify the issue that cause this so?

YasserRabee commented 1 month ago

@loic-parent I contacted support and they informed me that there should be no active release (version code) requesting this permission across all tracks. Also, if you are using a rolling release there can't be an older release that is requesting this permission.

I solved my problem by releasing a new version code across all tracks (even paused tracks) and rolled out to 100%.

loic-parent commented 1 month ago

@YasserRabee thank you for this information :)

I am not sure to understand what you have done with it. Could you tell me how you deleted or updated tho no active release versions to fix this?

Thanks, Loïc

loic-parent commented 1 month ago

Ok I get it! It is related to an old internal test release that used this features.

Thank you for the share :) I contacted Google too about it. Here is the process I have done to solve this:

I removed explicitly the permission for "USE_EXACT_ALARM" in the AndroidManifest file:

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

Then, I had paused the track of the old internal test version (218): pause-test-release


Finally, I go to the app-content and see the error for the "USE_EXACT_ALARM" and declared the goal of this permission for the old app bundle as an "agenda": image image image image


After that, I had the ability to send the new release in checking 🙂

Have a nice day, Loïc