Hi i've an andengine application created with ScreenOrientation.LANDSCAPE_SENSOR:
@Override
public EngineOptions onCreateEngineOptions() {
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
CAMERA_WIDTH = displaymetrics.widthPixels;
CAMERA_HEIGHT = displaymetrics.heightPixels;
camera = new ZoomCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
engineOptions.getAudioOptions().setNeedsSound(true);
but nothing happend when i rotate the device i already tried to add
android:configChanges="orientation"
android:screenOrientation="sensor"
like this
<activity
android:name=".activities.AquaActivity"
android:configChanges="orientation"
android:screenOrientation="sensor"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
it seems to recognize the orientation on start with this, but the orientation doesn't change while running the app
have i to do something special to get it work?
You don't need the XML settings, nor you have to do anything special. I am using LANDSCAPE_SENSOR without the extra lines in manifest. There is also nothing obviously wrong with your code.
If your app normally works (i.e. scene shows correctly, everything moves etc), and other apps/games rotate the screen correctly, then the last thing that comes on my mind is that you might be using older version of Android SDK than GingerBread (API level 9), which is a requirement for the LANDSCAPE_SENSOR to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With