How to decipher between tablet and phone

You must Login before you can answer or comment on any questions.

For iOS it's super easy Ti.Platform.osname It's either going to be iphone, ipad or android.

I know how to do this with iOS but android I am struggling. Say I want a different layout for an android tablet versus an android phone...how would I do that?

2 Answers

Here is the code that I use in my applications:
//considering tablet to have one dimension over 900px - this is imperfect, so you should feel free to decide
    //yourself what you consider a tablet form factor for android
    var isTablet = osname === 'ipad' || 
        (osname === 'android' && (width > 899 || height > 899));
 
    var Window;
    if (isTablet) {
        // Tablet specific code
    }
    else {
        // Phone specific code
    }

Your Answer

Think you can help? Login to answer this question!