Flutter image rotation on signage android TV doesnt work

31 Views Asked by At

Wrote a sample android app in Flutter 3.16.7 - to rotate images on android device, using below peace of code. The same works well on android cell phone or tablet, but the intent is for this to run on android signage TV. But it doesn't. Any help would be appreciated.

SystemChrome.setPreferredOrientations([
              DeviceOrientation.landscapeLeft,
              DeviceOrientation.landscapeRight
            ]);

So i also tried using android native code - but that also doesn't seem to work as expected.

MethodChannel(flutterEngine.dartExecutor.binaryMessenger, channelOrientation).setMethodCallHandler {
                call, result ->
            when (call.method) {
                setLandscapeRight -> {
                    this.activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
                }
                setLandscapeLeft -> {
                    this.activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
                }
                setPortraitUp -> {
                    this.activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
                }
                setPortraitDown -> {
                    this.activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
                }
            }
        }
    }

The code snippet is expected to rotate the images in 90/ 180/270 degrees on a signage android TV. It works well on android phone or tablet but not TV

0

There are 0 best solutions below