Reputation: 91
Im having serious problems with screen rotation in Windows Phone. The project I
m currently working started in the WP 8.0 version. After the 8.1 release, I updated my VS 2013 to the 2nd update and I migrate my project to 8.1. My problems is that, when I try to use the command: “DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape”, inside a click button event, the app running on my device (nokia lumia 920 with 8.1) does absolutely nothing.
I also tried to change the Supported Orientation Option in Package.appxmanifest but such option is not presented there! !
The weirdest thing is that everything works just fine (both code, and the appearance of the “Supported Orientation” option in the Package.appxmanifest) when I create from scratch a new project WP 8.1 project in visual Studio. I also noticed some other differences like the lack of wmappmanifest.xml on this scratch project.
If you guys want to check the issue, download the google ad sample for WP, upgrade it to 8.1 and add the rotation code above. It will do nothing. If you create a new empty 8.1 project and do the same thing, everything works fine. https://developers.google.com/mobile-ads-sdk/download#downloadwp
My question is, what the hell is going on with project migration? Is there anything I`m missing, so that the old project is no totally upgraded yet?
Upvotes: 0
Views: 995
Reputation: 4024
DisplayInformation.AutoRotationPreferences
is for WP8.1 RT (RunTime) apps only. When your upgrade your existing WP8 app to WP8.1 it is still a WP silverlight app. Thats what the problem is. When you create a WP8.1 from scratch you are creating a WP8.1 RT app. So the code works.
Take a look at the MSDN reference on the bottom is states that the API is only for Win8.1 RT Apps
Upvotes: 1