For phone vs tablet i want to use different layouts since on a Tablet you do have more space available.
How can I detect if a device is a Phone vs a Tablet? This is for both iOS and Android.
The Device class will let you know.
@JMarcus The Device class tells my samsung galaxy tab 2 as phone if i start the app in landscape mode. Any views on that.
Add the Xamarin.Essentials nuget package to your project. Then use this code:
var idiom = DeviceInfo.Idiom;
For more info, read it here
This is an old thread that has been re-awoken.
IMHO, Device.Idiom and DeviceInfo.Idiom are normally not what should be used. If an app requires functionality provided by the hardware or o/s, it should ideally test whether that functionality is available on the current device, rather than assume that testing Idiom is equivalent to testing for functionality. Even if it's just a case of is there enough screen space available for a particular layout, it's better to test for the space required rather than use Idiom (although in most cases, it's possible to build a responsive UI without testing having a high-level test on space required).
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies