Shankar Naik
Shankar Naik

Reputation: 411

How to distinguish winphone from UWP in xamarin PCL

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

Upvotes: 1

Views: 58

Answers (1)

Jason
Jason

Reputation: 89102

use Device.RuntimePlatform

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

Upvotes: 0

Related Questions