Bug 15029 - OnConfigurationChange() not called on Android API 13 and above
Summary: OnConfigurationChange() not called on Android API 13 and above
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.8.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2013-09-26 20:43 UTC by Jon Goldberger [MSFT]
Modified: 2013-09-27 13:58 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Case (11.06 KB, application/zip)
2013-09-26 20:43 UTC, Jon Goldberger [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Jon Goldberger [MSFT] 2013-09-26 20:43:46 UTC
Created attachment 5000 [details]
Test Case

I recently found out that many devices on the Play Store were being blocked because I had set my minimum API to 8 and my Target API to 8. I recently moved my Target API to 14 but now my screens go blank when I rotate them. I need a minimum of API 8 but I also need to at least get out to API 14. In searching the internet I find common solutions of

[Activity(Label = "TallyMaster9", ConfigurationChanges = Android.Content.PM.ConfigChanges.Orientation, Theme = "@layout/splash", MainLauncher = true, Icon = "@drawable/tm")]

And or

android:configChanges="orientation|screenSize" in the manifest

in either/or case I can no longer trigger OnConfigurationChanged to manage the screen orientation change.
===============================================================================================
This all works with a target API of 12 or lower. 
But neither of the above methods work to call OnConfigurationChange() with an orientation change with target API of 13+
===============================================================================================
Comment 2 Jonathan Pryor 2013-09-26 21:34:52 UTC
Please specify both ConfigChanges.Orientation and ConfigChanges.ScreenSize within ActivityAttribute:

  [Activity (Label = "TallyMaster9",
      ConfigurationChanges = ConfigChanges.Orientation
  #if __ANDROID_13__
        | ConfigChanges.ScreenSize,
  #endif
      Theme = "@layout/splash",
      Icon = "@drawable/tm",
      MainLauncher = true)]
  ...

(The wrapping of ConfigChanges.ScreenSize within `#if __ANDROID_13__` is so that you can easily set the $(TargetFrameworkVersion) to something prior to Android v3.2 without getting compilation issues because of specifying ConfigChanges.ScreenSize.)

> And or
> android:configChanges="orientation|screenSize" in the manifest

_How_ did you edit the manifest? Editing the manifest can be tricky. You may want to view e.g. obj\Debug\android\AndroidManifest.xml to ensure that it contains what you think it contains.