PDA

View Full Version : PhoneGap white screen "onLaunch" in a Controller



Carlos.D
2 Dec 2011, 12:13 AM
Hi,

When you build a panel an onLaunch in a Controller only a white screen appear with PhoneGap, but works fine in a browser, sample :


app/app.js:



Ext.Loader.setConfig({ enabled: true });


Ext.application({
name: 'Test',
controllers: ['Control']

});



app/controller/control.js:



Ext.define('Test.controller.Control', {
extend: 'Ext.app.Controller',


onLaunch: function() {

var panel = Ext.create('Ext.Panel', {



items: [
{
dock : 'top',
xtype: 'toolbar',
title: 'Standard Titlebar'
},
{
dock : 'top',
xtype: 'toolbar',
ui : 'light',
items: [
{
text: 'Test Button'
}
]
}
],


html: 'Testing'
});


Ext.Viewport.add(panel);
Ext.Viewport.setActiveItem(0);


}
});


Any solution ? Perhaps can we said to the controller "wait for PhoneGap" ?

Thx

olouvignes
2 Dec 2011, 2:13 AM
Are you using IOS4.3 or IOS5 in the simulator ?

Carlos.D
2 Dec 2011, 2:15 AM
Sorry, it's for an Android app. I'm trying with the 3.2 API level.

Carlos.D
2 Dec 2011, 5:59 AM
But any suggestion would be appreciated...

olouvignes
2 Dec 2011, 6:06 AM
Check if the "deviceready" event is correctly fired, which ST2.0 version do you use?

Carlos.D
2 Dec 2011, 6:24 AM
I'm not aware about this "device ready event", can you show me a sample ?
I'm using ST2 PR2.

Thx

olouvignes
2 Dec 2011, 7:02 AM
It is a phonegap event that ST2.0pr2 waits to start. It seems broken.
Try to apply the patch there:
https://github.com/mgcrea/sencha-touch/commit/ed994d6781866be70713995b593cd9719057a0a4

olouvignes
2 Dec 2011, 7:04 AM
Hum, since your on android, that won't work. Try to add sth like this in your html:



<script type="text/javascript">
document.addEventListener("deviceready", function() {
console.warn('deviceready!');
});
</script>

Carlos.D
2 Dec 2011, 7:20 AM
Finally it's seems to work with this patch ! Do you know where can I find mimimized file ? ST2 team already know the bug ?

Thank you Olouvignes.


Guys be careful with the casse "control.js != Control.js"...

rdougan
3 Dec 2011, 3:48 PM
So, Ext.os.deviceType on Android is Desktop?

Carlos.D
5 Dec 2011, 10:08 AM
Sorry, I don't understand your question.