Differentiate between PC web browser and android device browser

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

As I understand , we can use Ti.Platform.osname to get the os name on which the application is working . When we develop and run it on a browser , we get the osname as mobileweb and as android when we run it natively .

However I want to knwo whether the application is working on PC browser or Android device browser . Is there any way I can get this info in my code ?

1 Answer

You can achieve it by detecting the screen size (Width or height) Ti.Platform.displayCaps.platformwidth; and Ti.Platform.displayCaps.platformheight; certainly the screen size of the PC Monitor is higher than the maximum android tablet or any device.

— answered 10 months ago by Jibran Khan
answer permalink
2 Comments
  • This is exactly what I thought upfront , to get platformHeight and width . However the height width is the screen resolution , and if the PC user is using a 1280x768 res , the determination would be false .

    — commented 10 months ago by Saurabh Pawar

  • Yes in that case it will be ambiguous to determine, hope to find out any other solution for that

    — commented 10 months ago by Jibran Khan

Your Answer

Think you can help? Login to answer this question!