I would like to get info about a device to see if it's a smartphone or tablet. How can I do it?
I would like to show different web pages from resources based on the type of device:
String s="Debug-infos:";
s += "\n OS Version: " + System.getProperty("os.version") + "(" + android.os.Build.VERSION.INCREMENTAL + ")";
s += "\n OS API Level: " + android.os.Build.VERSION.SDK;
s += "\n Device: " + android.os.Build.DEVICE;
s += "\n Model (and Product): " + android.os.Build.MODEL + " ("+ android.os.Build.PRODUCT + ")";
However, it seems useless for my case.
This solution works for me now:
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = metrics.widthPixels;
int height = metrics.heightPixels;
if (SharedCode.width > 1023 || SharedCode.height > 1023){
//code for big screen (like tablet)
}else{
//code for small screen (like smartphone)
}