How to distinguish winphone from UWP in xamarin PCL

69 Views Asked by At

I have a xamarin native project.

In the PCL I would like to differentiate if its running winphone or uwp

I can easily differentiate iOS,Android and windows as whole(winphone and UWP)

I don't know how to differentiate winphone from UWP

Here is what I tried

 var platform = CrossDeviceInfo.Current.Platform;
            if (platform != Plugin.DeviceInfo.Abstractions.Platform.Windows && platform != Plugin.DeviceInfo.Abstractions.Platform.WindowsPhone){

 }

even uwp project says its windowsphone ..

I was hoping xamarin.winphone is windowsphone and uwp is windows.. but turns out both are winphone

I am using CrossDeviceInfo .. I couldn't find a way to do that

1

There are 1 best solutions below

1
On

use Device.RuntimePlatform

if (Device.RuntimePlatform == Device.WinPhone) ...
if (Device.RuntimePlatform == Device.Windows) ...