aliozgur / Xamarin.Plugins

MIT License
16 stars 10 forks source link

Device orientation incorrect for some devices #4

Open JoshuaNovak919 opened 8 years ago

JoshuaNovak919 commented 8 years ago

I ran into an issue with the plugin stating the wrong orientation for certain devices. I ended up using this code and it worked for all devices.

var activity = (Activity)Xamarin.Forms.Forms.Context;
return (activity.Resources.Configuration.Orientation.ToString() == "Landscape")? DeviceOrientations.Landscape : DeviceOrientations.Portrait;

The main devices I had issues with were Sony Xperia Tablets, specifically the Xperia Tablet Z.

aliozgur commented 8 years ago

@JoshuaNovak919 strange. The plugin uses the method described in this API guide