Unity-Technologies / com.unity.mobile.notifications

Mobile Notifications Package
https://docs.unity3d.com/Packages/com.unity.mobile.notifications@2.1/manual/index.html
Other
132 stars 42 forks source link

Google Play Rejects Android Apps Using USE_EXACT_ALARM Permission #313

Closed KylHA closed 9 months ago

KylHA commented 9 months ago

Issue Description:

Problem: Starting from Android 13/14, the SCHEDULE_EXACT_ALARM flag is no longer provided by default. This means that when using the notification package, but the USE_EXACT_ALARM permission comes by default when using the package. If the app is not a Calendar or alarm clock app, Google Play rejects the app.

Details: We're using com.unity.mobile.notifications version 2.3.1 and Unity 2021.3.34f1. After building, in AndroidNotificationPostProcessor.cs at line 97, the script adds the USE_EXACT_ALARM permission to the Manifest. However, removing the checkmark after the build does not update the Manifest accordingly and still adds the USE_EXACT_ALARM permission.

aprius commented 9 months ago

You can see how to fix it here

KylHA commented 9 months ago

You can see how to fix it here

Yes you can "In Notification Setting disable Add Use Exact Alarm Permission" but if you take a build with the permission enabled, it writes the permission its own AndroidManifest.xml file and disabling the checkmark does not make a difference. The permission stays in the file and you need find and manually edit the AndroidManifest.xml file inside the notification package.

aprius commented 9 months ago

You can see how to fix it here

Yes you can "In Notification Setting disable Add Use Exact Alarm Permission" but if you take a build with the permission enabled, it writes the permission its own AndroidManifest.xml file and disabling the checkmark does not make a difference. The permission stays in the file and you need find and manually edit the AndroidManifest.xml file inside the notification package.

In that case, try deleting the build cache and then building again. I also tried changing that flag in successive builds but they seem to work normally as evidenced by the previous build google play rejected it when Add Use Exact Alarm Permission was enabled then I turned it off and rebuild it successfully uploaded to google play console

aurimasc commented 9 months ago

Just tried and this permission is not added to newly created project by default, so you must have enabled it yourself (or had everything enabled in the past and later upgraded to new version). Or you've been building on top of existing build and had some leftovers. It is recommended to do a build to an empty folder when making a release.

KylHA commented 8 months ago

Hi, the problem is, it does not appear in the manifest. Try building an apk for android then open apk with winrar or something similar. On winrar [image: 0ff115da-5db9-473d-ac58-85e958a1e769.png]

Press find and write the "USE_EXACT_ALARM" on the "String to find" area and wait a couple of minutes to complete its search (it writes "Done" on the new panel depending on your file size). it puts the permission string on arm64 and arm7 files.

How I got around it.

fzfking @.***>, 16 Şub 2024 Cum, 16:58 tarihinde şunu yazdı:

We have simillar problem. Our settings: default.png (view on web) https://github.com/Unity-Technologies/com.unity.mobile.notifications/assets/48185056/fda6f3ef-46b6-4e91-b138-7d4c2bc58a63 . We checked android manifest after build and it has only Schedule Exact Alarm permission. But Google play rejects our app every time. We tried clean build but no difference. Using Unity 2022.3.5f1 and Mobile Notifications 2.2.2.

— Reply to this email directly, view it on GitHub https://github.com/Unity-Technologies/com.unity.mobile.notifications/issues/313#issuecomment-1948434227, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3ALDOVLJUP3CNP735TWXDYT5QYHAVCNFSM6AAAAABDBDF7R2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBYGQZTIMRSG4 . You are receiving this because you authored the thread.Message ID: <Unity-Technologies/com.unity.mobile.notifications/issues/313/1948434227@ github.com>