Bad idea, this can also return true for laptops/PCs with touch-enabled screens.
In general, you shouldn’t write code for specific platforms. You should write code that is able to adapt to varying screen sizes and varying input modes.
Resources:
EDIT: removed incorrect code listing.