I'm working on the android live wallpaper applications and need to correctly handle screen orientation changes.
Currently I use onConfigurationChanged
for this purpose(in this method I need to change coordinates of my LWP screen elements. I use andengine
). Everything works fine on the emulators and my test phones, but some my customers with Samsung Galaxy Note2 (t03g), LG thrill(LGE LG-P925) reports the issues with incorrect application work during the screen orientations change.
I don't have these phones on hand, but can suppose that the issue is related to onConfigurationChanged
not being called.
Is it correct to use onConfigurationChanged
method ? Maybe I need to use onSurfaceChanges
or something like that ? Could you please suggest me the correct way to solve this issue ?
Alos, I have added android:configChanges="keyboardHidden|orientation"
into my AndroidManifest.xml
:
<activity
android:name=".WallpaperSettings"
android:configChanges="keyboardHidden|orientation"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.PREFERENCE" />
</intent-filter>
</activity>
In my live wallpaper, which handles orientation changes, I use the onConfigurationChange()
method to check for orientation changes, but I don't have any direct experience with the 2 phones, though I've never gotten any complaints about them. My method looks something along the lines of:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Checks the orientation of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
rotated = true;
}
else {
rotated = false;
}
}
And in the draw()
method, I check the rotated
boolean. There's additional checks in the onSurfaceChanged()
to correct for resolution changes when the orientation changes.
I don't have android:configChanges="keyboardHidden|orientation"
in my manifest file at all.