Search Issue Tracker
Third Party Issue
Votes
0
Found in
2020.3.42f1
Issue ID
UUM-40109
Regression
No
[Android] BeforeSplashScreen methods are re-triggered after modifying Android notification settings
1. What happened
Hello Unity team!
We have found a strange behavior that happens in Android 13 devices both targeting SDK 33 and lower, which does not happen in lower Android version devices and is related to the RuntimeInitializeOnLoadMethods-BeforeSplashScreen:
On an Android 13 device, if you have opened the game and granted notification permissions, put it in background, go to Android settings, disable the permission and re-enable it again; when the app is put in the foreground again, the RuntimeInitializeOnLoadMethods with RuntimeInitializeLoadType.BeforeSplashScreen are triggered again, even that the application was in background and already initialized.
This causes that we cannot rely on these methods to initialize our services as they will initialize more than once. We can implement a fix on our side for this, but we are wondering if this is the expected behavior as it does not happen on Android 12 devices.
Maybe it is related to the new Android notification permission management for Android 13 devices, but, I don't see behavior differences targeting SDK 33 (implementing this new permission) or lower versions (the permission is managed by the OS).
2. How can we reproduce it using the example you attached
1- Uncompress the attached “IN-40049” project
2- In Android Studio synchronize the Logcat with the Android 13 device that will be tested to check its registers, for easy reading, filter the registers by using 1540379
3- Build and Run the app on an Android 13 device
4- Check the logcat in Android Studio, you should see messages like:
1540379_BeforeSplashScreen - Core Register
1540379_Static ScopelySdkPackageSetupRepository ctor - _packagesSetup before:
etc, this is expected.
5- Put the app in background and check the Android App permissions: Go to the Android Settings > Apps Settings > your app settings > Notifications settings, and check that the notification permissions are enabled, if they are enabled, disable the permissions and re-enable them again, then select the app and check the logcat, you should see the messages in point 4 are triggered again.
Comments (1)
-
Emily60
Jun 14, 2023 09:20
Hi everyone I am Emily Naomi wanna give a big thanks to this wonderful psychic for bringing my husband back to me… I never really believed in magic spells or anything spiritual but a trusted friend opened my eyes to the truth about life. My marriage was heading to divorce a few months ago. I was so confused and devastated with no clue or help on how to prevent it, till I was introduced to this psychic Priest Ray that did a love spell and broke every spiritual distraction from my marriage. A day later my husband started showing me love and care even better than it used to be, he’s ready to talk things through and find ways for us to stay happy. It’s such a miracle that my marriage can be saved so quickly without stress. You can also contact him for help by email psychicspellshrine@usako. net
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- UI Builder can't set a background image to a sprite from a multi-sprite spritesheet in the Resources folder
- Light2D freeform does not render the internal part when rendered in certain shapes
- Using AddCopyPass causes an incorrect merging of passes.
- Negative Enum value is not pasted correctly when copying from another array
- Silent Crash when generating Lightmap UVs for a model with a large object scale
Resolution Note:
I made an Android app using Android Studio and printed the Android activity life cycle to check if this is caused by Android or not.
I was able to confirm that turning off notifications ends the process. After that, when I accessed the app from the recent apps list, I could see it printing onCreate again. I think RuntimeInitializeLoadType.BeforeSplashScreen was triggered again because Android killed the process when the Notification was turned off.