Thursday, August 25, 2011

[android-developers] In-App Billing forces screen orientation change

Hello!

I'm trying to deal with an issue taking place when Google Checkout
window (by its intent, I believe) appears over my application.

I've been performing tests on Motorola Milestone/Droid, but I do know
about several other devices behaving the same way. I took "Dungeons
Example" from Google to keep the case as simple as possible.

Two screenshots I prepared: http://goo.gl/OouW0

Here's the scenario:
- I'm building Dungeons Example AS IS with one change in manifest:
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
I'd like it to keep portrait orientation just like my application
does. No other changes.

- App is installed and launched, device is kept in lanscape
orientation. The display looks like on the 1st screenshot.

- Buy button is pressed, Google Checkout window appears. Both Dungeons
activity and billing intent(?) rotate to landscape (screenshot 2),
although screenOrientation has been set to portrait.

- Once Google Checkout finishes its operations or is skipped Dungeons
activity goes back to foreground and orientation is also changed back
to portrait.


The issue seems to be minor on this example, as Dungeons handle screen
rotation properly, but in my app the effect is much worse and
definitely cannot be accepted.

Does anyone ever met similar behaviour? Anyone knows the solution?

I trhied to investigate it a little deeper and onConfigurationChanged
method is called twice, on Google Checkout window showing and hiding.
The ridiculous thing is that in both cases Configuration parameter
passed is exactly the same as current Configuration.
Here's the code:
@Override
public void onConfigurationChanged(Configuration newConfig) {
Configuration c = getResources().getConfiguration();
Log.v(TAG, "--- new " + newConfig.equals(c));
super.onConfigurationChanged(newConfig);
}
Everytime I get "----- new true" output, so Configuration does not
change but the orientation do...

My previous idea was to change the orientation field in newConfig
object passed, like here:
@Override
public void onConfigurationChanged(Configuration newConfig) {
newConfig.orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
super.onConfigurationChanged(newConfig);
}
Didn't help.

The same way there was no success on passing "c" object from my
listing to super.onConfigurationChanged neither on attempt to call
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);


What am I doing wrong? Is this a bug in In-App Billing or am I missing
something in my reasoning?

Any help will be appreciated.

Regards!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment