Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Cannot rotate Android device when Share dialog is open #102

Open
philipgen opened this issue Mar 1, 2021 · 1 comment
Open

Cannot rotate Android device when Share dialog is open #102

philipgen opened this issue Mar 1, 2021 · 1 comment
Labels

Comments

@philipgen
Copy link

philipgen commented Mar 1, 2021

Description of the bug

Cannot rotate Android device when Share dialog is open

Reproduction steps

  1. Open the Share Dialog
  2. Rotate the device

Expected: Device rotates

Acutal: Device does not rotate

Note: Behavior does not happen on iOS

Platform specs

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

  • Unity version: 2019.4.16
  • Platform: Android
  • Device: *all Android devices. But specificially a Samsung S3, S5e, A40
  • How did you download the plugin: Github

Additional info

I have attached a simple Unity project and apk . (Be sure to rename the apk.zip to apk as I cannot attach apk)
Share File.zip
ShareFile.apk.zip

@philipgen philipgen added the bug label Mar 1, 2021
@yasirkula
Copy link
Owner

yasirkula commented Mar 2, 2021

I can reproduce the issue. I'm not sure how it can be resolved, though. Here are my findings and some additional information:

  • I call ACTION_SEND intent from a fragment to receive onActivityResult (share result) callback
  • While this fragment is active, Unity activity is halted by the OS (you can see that your game is paused until share intent is finished or canceled); so the fragment has the focus instead of the Unity activity
  • As far as I understand, the android:configChanges="...|orientation|..." line in Unity's AndroidManifest lets Unity handle the orientation changes manually inside UnityPlayerActivity.java's @Override public void onConfigurationChanged(Configuration newConfig) function
  • My guess is that this function isn't called when Unity doesn't have the focus (e.g. when share fragment has the focus)
  • I've tried adding the following function to my fragment but it didn't work:
@Override
public void onConfigurationChanged( Configuration newConfig)
{
	super.onConfigurationChanged( newConfig );
	getActivity().onConfigurationChanged( newConfig );
}

So, I don't know how this issue can be resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants