Skip to content

Instantly share code, notes, and snippets.

@AbreuY
Created April 11, 2020 10:05
Show Gist options
  • Save AbreuY/de15d77d6d2e2330d3dd7516dd52ec69 to your computer and use it in GitHub Desktop.
Save AbreuY/de15d77d6d2e2330d3dd7516dd52ec69 to your computer and use it in GitHub Desktop.
[Solución] Android 8.0 Only fullscreen opaque activities can request orientation
@SuppressLint("SourceLockedOrientationActivity")
public static void chequeaVersion(Activity activity){
//Verifica si es diferente de android O
if (android.os.Build.VERSION.SDK_INT != Build.VERSION_CODES.O){
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Log.d("TAG", "No es android O");
}else{
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
Log.d("TAG", "Es android O");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment