Hybrid View

  1. #1
    Sencha User
    Join Date
    Jan 2011
    Posts
    54
    Vote Rating
    0
    chandramuralis is on a distinguished road

      0  

    Default Why Android Tablets are considered as Phone?

    Why Android Tablets are considered as Phone?


    I ran my sencha touch application in Android Galaxy and Motorola Xoom, both of them where treated as Phone form factor. When I checked the Support.js class I found that Sencha touch considers a device as a tablet only if it is an iPad. How to determine Android tablets? I doubt how this will treat Blackberry playbook device.

    Code:
    /**
    * @property Tablet True if the browser is running on a tablet (iPad)
    */
    this.Tablet = this.iPad;
    /**
    * @property Phone True if the browser is running on a phone.
    * @type {Boolean}
    */
    this.Phone = !this.Desktop && !this.Tablet;

  2. #2
    Sencha User realjax's Avatar
    Join Date
    Aug 2009
    Location
    Netherlands
    Posts
    412
    Vote Rating
    6
    realjax is on a distinguished road

      0  

    Default


    Quote Originally Posted by chandramuralis View Post
    How to determine Android tablets?
    Check the browsers window.navigator object. But I suspect all you'll find is a ref. to it being Android and that this is the exact reason why Touch can't determine it either.
    It doesn't really matter either to your app, the app thinking it is running on a phone with a bigger screen is fine I guess. Can't see any problems.

  3. #3
    Sencha User
    Join Date
    Jan 2011
    Posts
    54
    Vote Rating
    0
    chandramuralis is on a distinguished road

      0  

    Default


    The issue we have separate layout for our app based on phone and tablet. That is the reason I asked about this. Why Google doesn't separate their platforms? I wonder how others (websites) are determining Android mobile and tablet

  4. #4
    Sencha User realjax's Avatar
    Join Date
    Aug 2009
    Location
    Netherlands
    Posts
    412
    Vote Rating
    6
    realjax is on a distinguished road

      0  

    Default


    Quote Originally Posted by chandramuralis View Post
    The issue we have separate layout for our app based on phone and tablet.
    Then do a resolution check.

  5. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    15
    Vote Rating
    0
    Nikkelmann is on a distinguished road

      0  

    Default


    I recently came up with this solution:

    Code:
    if (Ext.is.Android && !Ext.is.Tablet && Ext.is.Phone) { /* Check for Android Tablet */
        Ext.is.Tablet = ((navigator || window.navigator).userAgent.toLowerCase().indexOf("mobile") == -1);
        Ext.is.Phone = !Ext.is.Tablet;
    }
    I based this on the fact that most Android phones have "mobile" in the userAgent string.
    http://stackoverflow.com/questions/5...eral-useragent

    Google Android engineers recommends to specifically detect “mobile” in the User-Agent string as well as “android”. Sencha should conform to this.
    http://googlewebmastercentral.blogsp...bile-user.html

    Edit: And so should I:
    Code:
    if (Ext.is.Android && !Ext.is.Tablet && Ext.is.Phone) { /* Check for Android Tablet */
        Ext.is.Phone = (Ext.userAgent.indexOf("mobile") > -1);
        Ext.is.Tablet = !Ext.is.Phone;
    }
    I chose not to check for the major version number, for example "android 3" since this will change in the future.

  6. #6
    Ext JS Premium Member cnelissen's Avatar
    Join Date
    Sep 2007
    Location
    California
    Posts
    224
    Vote Rating
    8
    cnelissen will become famous soon enough

      0  

    Default


    Thanks for the code, though it can be shortened to just:

    Code:
    if (Ext.is.Android) {
    	Ext.is.Phone = Ext.userAgent.indexOf('mobile') > -1;
    	Ext.is.Tablet = !Ext.is.Phone;
    }
    - Clint Nelissen

  7. #7
    Sencha User
    Join Date
    Apr 2013
    Posts
    2
    Vote Rating
    0
    FrankGarcia is on a distinguished road

      0  

    Default


    Quote Originally Posted by chandramuralis View Post
    The issue we have separate layout for our app based on phone and tablets. That is the reason I asked about this. Why Google doesn't separate their platforms? I wonder how others (websites) are determining Android mobile and tablet
    I think Galaxy tabs are best for phone and other features. Which tablets you prefer? Are there better tablets than Galaxy?

Similar Threads

  1. textarea docked over form in android phone after scrolling
    By avishek1 in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 24 Feb 2012, 1:22 PM
  2. How to simulate slide transition on Android phone?
    By locutusUT in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 26 Jul 2011, 7:03 AM
  3. Application goes to freeze in Android Phone
    By avishek1 in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 26 Dec 2010, 8:35 PM
  4. Android Phone Issue
    By avishek1 in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 24 Dec 2010, 2:00 AM
  5. Replies: 3
    Last Post: 8 Sep 2010, 4:13 PM

Thread Participants: 5

Tags for this Thread