After updating recently to Unity 2021.3.40 and trying to submit an update to my Android app on Google Play I noticed that “android.permission.ACCESS_NETWORK_STATE” permission is now gone from apk.
My app uses IAP and in every previous Unity Editor version for last 5+ years this permission was always present in every apk with IAPs I ever built, along with “android.permission.INTERNET” and “com.android.vending.BILLING”.
As a test, I rolled back to Unity 2021.3.36, and after compiling, “android.permission.ACCESS_NETWORK_STATE” was present in compiled apk.
Built same project with 2021.3.39 and 2021.3.40 again, and this permission is gone. So it apparently depends on Editor version used, and this issue (feature?) appeared only recently.
Now I’m afraid to submit anything to Google, since I don’t know if this is a bug or a feature. And how this permission affects IAP functionality. Can anybody clarify this issue, please?
The android.permission.ACCESS_NETWORK_STATE permission is automatically added when you app calls UnityEngine.Application::get_internetReachability.
For some reason after update, your app (or plugins) are not calling get_internetReachability() anymore, and therefore the permission is not added. My gut feeling is that this is not a bug.
Thanks for responding. I made a few more tests, and now I can reliably reproduce this issue on a completely blank project.
Steps to reproduce:
in Unity 2021.3.41, create a blank 3D project. Via package manager, install official IAP version 4.9.4. Nothing else is changed/added. Switch target platform to Android and compile apk.
In apk, 2 permissions are added (BILLING + INTERNET)
I tested 2021.2.39, 2021.3.40, 2021.3.41, and they all have this issue.
Is that enough of proof that at some point after 2021.3.36 there was a bug introduced, that prevents Unity IAP plugin from adding ACCESS_NETWORK_STATE into apk? Should I submit a bug report?