Search code examples
sencha-touch-2

Sencha Touch 2: Simulating different profiles (phone/tablet) on Desktop OS (Linux/Windows)


I am learning Sench Touch 2. I figured if I want my app to be "responsive" to phone vs tablet platforms, I can use Profiles.

Ext.define('Mail.profile.Phone', {
    extend: 'Ext.app.Profile',

    config: {
        name: 'Phone',
        views: ['Main']
    },

    isActive: function() {
        return Ext.os.is.Phone;
    },

    launch: function() {
        Ext.create('Mail.view.phone.Main');
    }
});

I am developing on Arch Linux with Chromium. I installed installed user agent switchers to fake running on a tablet/phone OS, but the profiles doesn't appear to change anything. I added console.log() in the launch function

I wonder if I am using Profiles for the right thing? For example, I may want my app to display a list and a details view on tablets, and the list, animating to the details view on a phone. If so, do I need a real tablet/phone just to test this profiles?


Solution

  • You can append deviceType=Phone or deviceType=Tablet to simulate these different device types.

    Example here:

    http://dev.sencha.com/deploy/touch/examples/production/kitchensink/index.html?deviceType=Phone