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

Only fullscreen opaque activities can request orientation #63

Closed
NunciosChums opened this issue Oct 28, 2017 · 24 comments
Closed

Only fullscreen opaque activities can request orientation #63

NunciosChums opened this issue Oct 28, 2017 · 24 comments

Comments

@NunciosChums
Copy link

NunciosChums commented Oct 28, 2017

version: tedpermission-rx2:2.0.3
phone: emulator Nexus 5X 26, 27

java.lang.RuntimeException: Unable to start activity ComponentInfo{kr.my/com.gun0912.tedpermission.TedPermissionActivity}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
   at android.app.ActivityThread.-wrap11(Unknown Source:0)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
   at android.os.Handler.dispatchMessage(Handler.java:106)
   at android.os.Looper.loop(Looper.java:164)
   at android.app.ActivityThread.main(ActivityThread.java:6494)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
   at android.app.Activity.onCreate(Activity.java:987)
   at android.support.v4.app.SupportActivity.onCreate(SupportActivity.java:66)
   at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:297)
   at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:84)
   at com.gun0912.tedpermission.TedPermissionActivity.onCreate(TedPermissionActivity.java:64)
   at android.app.Activity.performCreate(Activity.java:7000)
   at android.app.Activity.performCreate(Activity.java:6991)
   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
   at android.app.ActivityThread.-wrap11(Unknown Source:0) 
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
   at android.os.Handler.dispatchMessage(Handler.java:106) 
   at android.os.Looper.loop(Looper.java:164) 
   at android.app.ActivityThread.main(ActivityThread.java:6494) 
   at java.lang.reflect.Method.invoke(Native Method) 
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
@GrayaMax
Copy link

I had the same issue, the only fix i found for now is to use android support library 26.1.0. Its seems to be a problem with android library 27.0.0.

@JSpiner
Copy link
Contributor

JSpiner commented Nov 1, 2017

@GrayaMax can you tell me more information?

@GrayaMax
Copy link

GrayaMax commented Nov 1, 2017

@JSpiner sorry I don't have more information, i realized i get this error when i upgraded appcompat-v7 to version 27.0.0. So for now i return to version 26.1.0 and it still working. I will post more information if I find more.

@ParkSangGwon
Copy link
Owner

@susemi99 @GrayaMax @JSpiner
There are some problem.
After 27( Android O), If we use android:screenOrientation="portrait" in manifest, we got error like that.
If I remove that, we can solve.
But I dont think that is real solution.
I want to reason and try to real solution.

@socialvanana
Copy link

For Android developers,
Recommend to use targetSdkVersion as 26 instead of 27 for a while.

@andreas-
Copy link

andreas- commented Dec 4, 2017

Fix that worked for us
targetSdkVersion 27

and add TedPermissionActivity to your manifest where you override android:screenOrientation
<activity android:name="com.gun0912.tedpermission.TedPermissionActivity" android:configChanges="mcc|mnc|locale|keyboard|keyboardHidden|screenLayout|fontScale|uiMode|orientation|screenSize|layoutDirection" android:screenOrientation="unspecified" android:theme="@style/Theme.Transparent.Permission" tools:replace="android:screenOrientation"/>

@bbincybbaby
Copy link

?? can you explain it in more detail?

@BoxResin
Copy link
Contributor

BoxResin commented Jan 4, 2018

@andreas- Great. It works!

@JSpiner
Copy link
Contributor

JSpiner commented Jan 5, 2018

@ParkSangGwon
According to this commit.
Since android 'O'(26), we should satisfy following condition.

if (ActivityInfo.isFixedOrientation(requestedOrientation) && !fullscreen
                 && appInfo.targetSdkVersion >= O) {
             throw new IllegalStateException("Only fullscreen activities can request orientation");
         }

I think some of these solutions are possible.

  1. Enable fullscreen
  • Because the TedPermissionActivity is transparent. It doesn't matter.
  1. Set screenOrientation as unspecified
  • Same with @andreas- solution.
  • We don't know which direction the application using this library will use. So we should support all direction.
  1. Customize
  • add setScreenOrientation() function at PermissionBuilder
  1. Trick Code
  • First, enable fullscreen mode.
  • Set orientation as unspecified.
  • Reset fullscreen mode.
  • Done!

Give me your opinion. I'll make PR.

@andreas-
Copy link

andreas- commented Jan 5, 2018

@JSpiner
i'd suggest to go with option 2
We experienced wonky behavior when dealing with fullscreen activities and immersive mode. This library should not make assumptions about the orientation

@BoxResin glad i could help

@JSpiner
Copy link
Contributor

JSpiner commented Jan 9, 2018

@andreas-
I totally agree with you!
Also, I think it should support option 3.

add setScreenOrientation() function at PermissionBuilder

So I'll make PR using 1/3 option.

JSpiner added a commit to JSpiner/TedPermission that referenced this issue Jan 9, 2018
snowflake-1117 added a commit to jiunoh/ssok that referenced this issue Jan 15, 2018
ParkSangGwon added a commit that referenced this issue Feb 6, 2018
@ParkSangGwon
Copy link
Owner

This issue solved at 842b86f
And I will publish new version.
Thanks all guys

@minsik-ai
Copy link
Contributor

Please update new version with this issue, thank you.

@LivioGama
Copy link

+1

4 similar comments
@alexodus
Copy link

alexodus commented Mar 1, 2018

+1

@juice77
Copy link

juice77 commented Mar 1, 2018

+1

@melodysdreamj
Copy link

+1

@VOstopolets
Copy link

+1

@milad-mr
Copy link

milad-mr commented Mar 24, 2018

1+

@hamidraasti
Copy link

+1

@NicolasKun
Copy link

same problem. thanks for the explain 👍

@roman-ku
Copy link

roman-ku commented May 26, 2018

I'm still getting this problem. Was the fix pushed?

@fajaranugrah
Copy link

how to create only android:screenOrientation="portrait" ?
can you help me

@jughoor
Copy link

jughoor commented Oct 11, 2019

The problem is fixed in version gun0912.ted:tedpermission:2.2.0 but if you use gun0912.ted:tedpermission:2.2.2 with target version 28 the App will crash.

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

No branches or pull requests