Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException: Can not perform this action after onSaveInstanceState #15

Closed
coffee-lady opened this issue Nov 8, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@coffee-lady
Copy link

Description of the bug

Exception is thrown on some devices when trying invoke AndroidRuntimePermissions.RequestPermissionsAsync. I call CheckPermissions before request. I couldn't reproduce this, I see exceptions only in metrics.

Reproduction steps

If possible, providing reproduction steps would be very helpful while pinpointing the issue. You can also post screenshots if you think they would be helpful.

Platform specs

Please provide the following info if this is a Unity 3D repository.

  • Unity version: 2021.3.21f1
  • Platform: Android
  • Device: different Android versions Samsung has 40% cases;
  • How did you download the plugin: Package Manager, latest version

Additional info

Message: AndroidJavaException: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
Exception: java.lang.Throwable: 
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1898)
android.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1921)
android.app.BackStackRecord.commitInternal(BackStackRecord.java:688)
android.app.BackStackRecord.commit(BackStackRecord.java:646)
com.yasirkula.unity.RuntimePermissions.RequestPermission(RuntimePermissions.java:112)
com.unity3d.player.UnityPlayer.nativeRender(Native Method)
com.unity3d.player.UnityPlayer.access$500(Unknown Source:0)
com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:126)
android.os.Handler.dispatchMessage(Handler.java:106)
android.os.Looper.loop(Looper.java:219)
com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
UnityEngine.AndroidJNISafe.CheckException ()
UnityEngine.AndroidJavaObject._CallStatic (System.String methodName, System.Object[] args)
AndroidRuntimePermissions.RequestPermissionsAsync (System.String[] permissions)
@coffee-lady coffee-lady added the bug Something isn't working label Nov 8, 2023
@yasirkula
Copy link
Owner

I have a fix for this but I wonder why this happens. Is your app a standard Unity app, Unity as a Library app, an app that can run in the background, or maybe something unique in another way?

@coffee-lady
Copy link
Author

I have a fix for this but I wonder why this happens. Is your app a standard Unity app, Unity as a Library app, an app that can run in the background, or maybe something unique in another way?

It's just a game with Unity. I call permission check on app start.

@yasirkula
Copy link
Owner

I'm hoping that the latest release will resolve this issue.

@coffee-lady
Copy link
Author

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants