Home > Blockchain >  How to detect iOS device type Xamarin
How to detect iOS device type Xamarin

Time:06-29

I want to detect first what is the platform and the I want to detect is whether it is a phone or tablet. I searched on the internet there are many examples to detect with screen size like height-width, but is there anything which can let what is the device type.

if(Device.RuntimePlatform == Device.iOS)
{
    //what is the device type 
}
else if(Device.RuntimePlatform == Device.Android)
{
    //what is the device type
}

CodePudding user response:

Use this to detect device type.


if(Device.RuntimePlatform == Device.iOS)
{
    //what is the device type
   if (Device.Idiom == TargetIdiom.Phone)
   {
       Console.WriteLine(Device.Idiom);
   }
   else if(Device.Idiom == TargetIdiom.Tablet)
   {
       Console.WriteLine(Device.Idiom);
   } 

}
else if(Device.RuntimePlatform == Device.Android)
{
    //what is the device type
}

  • Related