1. #1
    Sencha User tomalex0's Avatar
    Join Date
    Apr 2009
    Location
    San Jose, CA
    Posts
    589
    Vote Rating
    16
    Answers
    1
    tomalex0 will become famous soon enough

      0  

    Default Unanswered: How Ext.os.deviceType works.

    Unanswered: How Ext.os.deviceType works.


    I was under the impression that Ext.os.deviceType works based on userAgent.
    I have changed userAgent in chrome from the settings option to that of android, till i'm getting deviceType as "Desktop" i was expecting something like "Phone"? I'm i missing something so simple which i'm yet to identify ?

    useragent.jpg
    Sencha Touch Demos

    IosToggleField Forum - Github
    Form Validation
    Forum - Github
    Iphone Settings Menu
    Forum
    Sqlite Storage & Login Manifest
    Forum
    KitchenSink MVC
    Forum - Github
    SqliteProxy-v1 Forum - Github
    SqliteProxy-v2
    Forum - Github
    Arshaw Fullcalendar Forum - Github






  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,652
    Vote Rating
    901
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    There are a few things that can affect this, here is the code that determines the type (in Ext.env.OS):

    Code:
        var search = window.location.search.match(/deviceType=(Tablet|Phone)/),
            nativeDeviceType = window.deviceType;
    
        // Override deviceType by adding a get variable of deviceType. NEEDED FOR DOCS APP.
        // E.g: example/kitchen-sink.html?deviceType=Phone
        if (search && search[1]) {
            deviceType = search[1];
        }
        else if (nativeDeviceType === 'iPhone') {
            deviceType = 'Phone';
        }
        else if (nativeDeviceType === 'iPad') {
            deviceType = 'Tablet';
        }
        else {
            if (!osEnv.is.Android && !osEnv.is.iOS && /Windows|Linux|MacOS/.test(osName)) {
                deviceType = 'Desktop';
    
                // always set it to false when you are on a desktop
                Ext.browser.is.WebView = false;
            }
            else if (osEnv.is.iPad || osEnv.is.Android3 || (osEnv.is.Android4 && userAgent.search(/mobile/i) == -1)) {
                deviceType = 'Tablet';
            }
            else {
                deviceType = 'Phone';
            }
        }
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User tomalex0's Avatar
    Join Date
    Apr 2009
    Location
    San Jose, CA
    Posts
    589
    Vote Rating
    16
    Answers
    1
    tomalex0 will become famous soon enough

      0  

    Default


    I had a look into those,
    For this
    http://docs.sencha.com/touch/2-0/touch-build/examples/production/list/index.html

    I
    have changed the userAgent to that of android and tried
    Code:
    var search = window.location.search.match(/deviceType=(Tablet|Phone)/), nativeDeviceType = window.deviceType;
    which return undefined.
    Sencha Touch Demos

    IosToggleField Forum - Github
    Form Validation
    Forum - Github
    Iphone Settings Menu
    Forum
    Sqlite Storage & Login Manifest
    Forum
    KitchenSink MVC
    Forum - Github
    SqliteProxy-v1 Forum - Github
    SqliteProxy-v2
    Forum - Github
    Arshaw Fullcalendar Forum - Github






Thread Participants: 1