PDA

View Full Version : Way to detect if Sencha Touch compatible device?



estesbubba
23 Apr 2012, 1:49 PM
I was wondering if I can use the Touch framework to detect if supported device and redirect if not? Or is this best done on the server side using DeviceAtlas or something else? Just wondering how others are doing this.

BTW, I can't find Ext.os in the docs.

mitchellsimoens
25 Apr 2012, 5:31 AM
I use MVC with profiles a lot and I have an Unsupported profile load first. If it is active then I display simple HTML to say this but you could technically have more user friendly looking unsupported html.

estesbubba
25 Apr 2012, 6:20 AM
Mitchell - can to share how to do this?

mitchellsimoens
25 Apr 2012, 6:29 AM
Sure, here is a quick test:


Ext.define('Test.profile.Unsupported', {
extend : 'Ext.app.Profile',

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

launch : function () {
Ext.Viewport.setHtml('You are not supported! Go away!');
}
});

Ext.define('Test.profile.Tablet', {
extend : 'Ext.app.Profile',

config : {
name : 'tablet',
namespace : 'tablet',
views : [
//'Viewport' //uncomment to load the view, will throw error if you test this code as-is
]
},

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

launch : function () {
new Test.view.tablet.Viewport();
}
});

Ext.application({
name : 'Test',

profiles : [
'Unsupported', //must go first to be eval'd first
'Tablet'
]
});

estesbubba
25 Apr 2012, 6:42 AM
Thanks man!

The RAZR fans aren't going to like your message :)

mitchellsimoens
25 Apr 2012, 7:10 AM
Thanks man!

The RAZR fans aren't going to like your message :)

haha Made me laugh when I ran my code to test :D