Hello,
In Xamairn, you could implement this requirement using the official DeviceType.
Please refer to the following documentation and sample code.
private void Button_Clicked(object sender, EventArgs e)
{
switch (DeviceInfo.DeviceType)
{
case DeviceType.Unknown:
break;
case DeviceType.Physical:
Console.WriteLine("device");
break;
case DeviceType.Virtual:
Console.WriteLine("emulator");
break;
default:
break;
}
}
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.