Android:在清单中使用 screenOrientation 并监听 configChanges

Android: using screenOrientation in the manifest and listening to configChanges

我有一个相机应用程序可以在两种横向模式(正常和反向)下工作,但不应允许纵向模式。我想在方向更改时收到通知以更正预览。所以我同时使用了这两个标签

android:screenOrientation="sensorLandscape"

android:configChanges="orientation|screenSize|keyboard|keyboardHidden"

在清单中。但是每当设置第一个时,方法

@Override
public void onConfigurationChanged(Configuration newConfig)

在我的 Activity 中不再被调用。当我完全省略 screenOrientation 标签时,它会起作用。这看起来很疯狂,有没有办法限制屏幕方向,但仍然会在屏幕方向改变时触发侦听器?

已解决 OrientationEventListener