nisrulz / easydeviceinfo

:iphone: [Android Library] Get device information in a super easy way.
Apache License 2.0
1.77k stars 227 forks source link

Detect Device Smartphone/Tablet or other #11

Closed webserveis closed 8 years ago

webserveis commented 8 years ago

If posible detected the app is running in Smartphone or Tablet , Tv

webserveis commented 8 years ago

Hi, I usage this code for detect if tablet

    public static boolean isTablet(Context context) {
        return (context.getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK)
                >= Configuration.SCREENLAYOUT_SIZE_LARGE;
    }
nisrulz commented 8 years ago

@webserveis Please check the referenced commit as the solution.

The one you have provided does not work all the time and has issues. I have checked the above and as per my testing with devices it fails on different devices by different manufacturers.

The provided solution is not merged into master as I am still testing it , but its is a better solution as it is based of the screen size metric.

nisrulz commented 8 years ago

code is merged into master and fixed for release 1.2.0, please reopen if having issues still.