[android] how to detect if is a tablet

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

Hi... what is the way to detect a smarthphone or tablet device ?

Thanks.

1 Answer

Hi, Javier

For now we dont have any default property to identify the tablet platform but as we know the width and height of the tablet is bigger than the mobile and so the only currently quick solution is to identify the tablet with its width and height.

I am using the same method for my projects.

App.Platform = {
 
    screenWidth: (Titanium.Platform.displayCaps.platformWidth > Titanium.Platform.displayCaps.platformHeight) ? Titanium.Platform.displayCaps.platformHeight : Titanium.Platform.displayCaps.platformWidth,
    screenHeight: ((Titanium.Platform.displayCaps.platformWidth > Titanium.Platform.displayCaps.platformHeight) ? Titanium.Platform.displayCaps.platformWidth : Titanium.Platform.displayCaps.platformHeight) - 38,
 
 
    getPlatformName: function() {
        return Titanium.Platform.osname;
    },
 
    isAndroid: function() {
        return Titanium.Platform.osname == 'android';
    }
};
for better understanding about this platform module. you can go here Titanium.Platform

I am hoping that 1.8 will come with some Tablet support with its features.

Regards

Nikunj

Your Answer

Think you can help? Login to answer this question!