Up until now, I was using the ScreenLayout to detect if an Android device is a phone or a tablet, to force the orientation to Portrait/Landscape. The problem with the code below is that, for devices such as the Google Pixel 2, it returns true for SizeLarge. Is there any bulletproof way to detect if a device can be classified as a tablet? I was thinking about using a ratio between the physical size of the screen and the DPI, but I feel that it still is prone to errors.
context = context ?? MainApplication.Context;
var screenLayout = context.Resources.Configuration.ScreenLayout & Android.Content.Res.ScreenLayout.SizeMask;
return screenLayout == Android.Content.Res.ScreenLayout.SizeLarge || screenLayout == Android.Content.Res.ScreenLayout.SizeXlarge;