Hello everybody,

I'm stuck for hours now on this problem, I have my application created with the last version of Sencha, who works fine on IOS and Android, using Phonegap 2.2.0 to pack everything.
Now I want to put my app on Blackberry using Webworks and Phonegap.

When I launch my application it stuck on the SplashScreen, I search a solution and it seems that maybe Sencha Touch 2 is loaded before Phonegap and could bring some problem, so I tried to modify my index.html to launch ST2 after Phonegap :

Code:
<script type="text/javascript" charset="utf-8">

    // Wait for PhoneGap to load
    //
        // register PhoneGap event listeners when DOM content loaded
        function initPhonegap() {
                        document.body.style.height = screen.height;
            console.log('init()');
                        document.addEventListener("deviceready", onDeviceReadyOT, true);
                        }

    // PhoneGap is ready
    //
    function onDeviceReadyOT() {                   
       
       
                
                    (function(i){function s(a){function b(a,j){var  c=a.length,b,g;for(b=0;b<c;b++){g=a[b];var e=a,K=b,d=void  0;"string"==typeof  g&&(g={path:g});g.shared?(g.version=g.shared,d=g.shared+g.path):(A.href=g.path,d=A.href);g.uri=d;g.key=h+"-"+d;f[d]=g;e[K]=g;g.type=j;g.index=b;g.collection=a;g.ready=!1;g.evaluated=!1}return  a}var c;"string"==typeof a?(c=a,a=B(c)):c=JSON.stringify(a);var  h=a.id,e=h+"-"+C+o,f={};this.key=e;this.css=b(a.css,"css");this.js=b(a.js,"js");this.assets=this.css.concat(this.js);this.getAsset=
function(a){return  f[a]};this.store=function(){t(e,c)}}function v(a,b){k.write('<meta  name="'+a+'" content="'+b+'">')}function p(a,b,c){var h=new  XMLHttpRequest,c=c||D,a=a+(-1==a.indexOf("?")?"?":"&")+Date.now();try{h.open("GET",a,!0),h.onreadystatechange=function(){if(4==h.readyState){var   a=h.status,d=h.responseText;200<=a&&300>a||304==a||0==a&&0<d.length?b(d):c()}},h.send(null)}catch(d){c()}}function  L(a,b){var  c=k.createElement("iframe");m.push({iframe:c,callback:b});c.src=a+".html";c.style.cssText=
"width:0;height:0;border:0;position:absolute;z-index:-999;visibility:hidden";k.body.appendChild(c)}function  E(a,b,c){var d=!!a.shared;if(a.remote)b("");else{if(!d)var  e=b,f=a.version,l,b=function(j){l=j.substring(0,f.length+4);l!=="/*"+f+"*/"?confirm("Requested:  '"+a.uri+"' with checksum: "+f+" but received:  "+l.substring(2,f.length)+"instead. Attempt to refresh the  application?")&&M():e(j)};(d?L:p)(a.uri,b,c)}}function F(a){var  b=a.data,a=a.source.window,c,d,e,f;c=0;for(d=m.length;c<d;c++)if(e=m[c],
f=e.iframe,f.contentWindow===a){e.callback(b);k.body.removeChild(f);m.splice(c,1);break}}function  G(a){"undefined"!=typeof  console&&(console.error||console.log).call(console,a)}function  t(a,b){try{n.setItem(a,b)}catch(c){if(c.code==c.QUOTA_EXCEEDED_ERR&&q){var  d=q.assets.map(function(a){return  a.key}),e=0,f=n.length,l=!1,j;for(d.push(q.key);e<=f-1;)j=n.key(e),-1==d.indexOf(j)?(n.removeItem(j),l=!0,f--):e++;l&&t(a,b)}}}function  u(a){try{return n.getItem(a)}catch(d){return null}}function M(){H||(H=
!0,p(o,function(a){(new  s(a)).store();i.location.reload()}))}function w(a){function b(a,d){var  b=a.collection,g=a.index,f=b.length,e;a.ready=!0;a.content=d;for(e=g-1;0<=e;e--)if(a=b[e],!a.ready||!a.evaluated)return;for(e=g;e<f;e++)if(a=b[e],a.ready)a.evaluated||c(a);else  break}function  c(a){a.evaluated=!0;if("js"==a.type)try{eval(a.content)}catch(b){G("Error  evaluating "+a.uri+" with message: "+b)}else{var  d=k.createElement("style"),c;d.type="text/css";d.textContent=a.content;"id"in  a&&(d.id=a.id);
"disabled"in  a&&(d.disabled=a.disabled);c=document.createElement("base");c.href=a.path.replace(/\/[^\/]*$/,"/");x.appendChild(c);x.appendChild(d);x.removeChild(c)}delete  a.content;0==--f&&h()}function h(){function  b(){k&&c()}function c(){var a=r.onUpdated||D;if("onSetup"in  r)r.onSetup(a);else a()}function  e(){l.store();h.forEach(function(a){t(a.key,a.content)});c()}function  g(a,b){a.content=b;0==--m&&(d.status==d.IDLE?e():i=e)}function  f(){I("online",f,!1);p(o,function(c){q=l=new s(c);var  e;l.assets.forEach(function(b){e=
a.getAsset(b.uri);(!e||b.version!==e.version)&&h.push(b)});m=h.length;0==m?d.status==d.IDLE?b():i=b:h.forEach(function(b){function  d(){E(b,function(a){g(b,a)})}var  c=a.getAsset(b.uri),e=b.path,f=b.update;!c||!f||null===u(b.key)||"delta"!=f?d():p("deltas/"+e+"/"+c.version+".json",function(a){try{var  d=b,c;var  e=u(b.key),f=B(a),a=[],h,j,i;if(0===f.length)c=e;else{j=0;for(i=f.length;j<i;j++)h=f[j],"number"===typeof   h?a.push(e.substring(h,h+f[++j])):a.push(h);c=a.join("")}g(d,c)}catch(k){G("Malformed  delta content received for "+
b.uri)}},d)})})}var  h=[],k=!1,i=function(){},n=function(){d.swapCache();k=!0;i()},m;I("message",F,!1);if(d.status==d.UPDATEREADY)n();else   if(d.status==d.CHECKING||d.status==d.DOWNLOADING)d.onupdateready=n,d.onnoupdate=d.onobsolete=function(){i()};!1!==navigator.onLine?f():y("online",f,!1)}var   e=a.assets,f=e.length,l;q=a;y("message",F,!1);0==f?h():e.forEach(function(a){var   c=u(a.key);null===c?E(a,function(c){a.remote||t(a.key,c);b(a,c)},function(){b(a,"")}):b(a,c)})}function  J(a){null!==k.readyState.match(/interactive|complete|loaded/)?
w(a):y("DOMContentLoaded",function(){navigator.standalone?setTimeout(function(){setTimeout(function(){w(a)},1)},1):w(a)},!1)}var   D=function(){},m=[],k=i.document,x=k.head,y=i.addEventListener,I=i.removeEventListener,n=i.localStorage,d=i.applicationCache,B=JSON.parse,A=k.createElement("a"),z=k.location,C=z.origin+z.pathname+z.search,o="app.json",H=!1,q;if("undefined"===typeof  r)var r=i.Ext={};r.blink=function(a){var  b=u(a.id+"-"+C+o);v("viewport","user-scalable=no, initial-scale=1,  maximum-scale=1, minimum-scale=1, width=device-width,  height=device-height, target-densitydpi=device-dpi");
v("apple-mobile-web-app-capable","yes");v("apple-touch-fullscreen","yes");b?(a=new  s(b),J(a)):p(o,function(b){a=new  s(b);a.store();J(a)})}})(this);;Ext.blink({"id":"ba7734f5-ef3e-4477-bcea-70fb8b8a9663"})                        
    }       
    </script>
Instead of putting the SenchaTouch2 initializer functions here :

Code:
    function onDeviceReadyOT() {
        // Empty                
    }
    </script> 
        
    <script type="text/javascript">
                    (function(i){function s(a){function b(a,j){var c=a.length,b,g;for(b=0;b<c;b++){g=a[b];var e=a,K=b,d=void 0;"string"==typeof g&&(g={path:g});g.shared?(g.version=g.shared,d=g.shared+g.path):(A.href=g.path,d=A.href);g.uri=d;g.key=h+"-"+d;f[d]=g;e[K]=g;g.type=j;g.index=b;g.collection=a;g.ready=!1;g.evaluated=!1}return a}var c;"string"==typeof a?(c=a,a=B(c)):c=JSON.stringify(a);var h=a.id,e=h+"-"+C+o,f={};this.key=e;this.css=b(a.css,"css");this.js=b(a.js,"js");this.assets=this.css.concat(this.js);this.getAsset=
function(a){return f[a]};this.store=function(){t(e,c)}}function v(a,b){k.write('<meta name="'+a+'" content="'+b+'">')}function p(a,b,c){var h=new XMLHttpRequest,c=c||D,a=a+(-1==a.indexOf("?")?"?":"&")+Date.now();try{h.open("GET",a,!0),h.onreadystatechange=function(){if(4==h.readyState){var a=h.status,d=h.responseText;200<=a&&300>a||304==a||0==a&&0<d.length?b(d):c()}},h.send(null)}catch(d){c()}}function L(a,b){var c=k.createElement("iframe");m.push({iframe:c,callback:b});c.src=a+".html";c.style.cssText=
"width:0;height:0;border:0;position:absolute;z-index:-999;visibility:hidden";k.body.appendChild(c)}function E(a,b,c){var d=!!a.shared;if(a.remote)b("");else{if(!d)var e=b,f=a.version,l,b=function(j){l=j.substring(0,f.length+4);l!=="/*"+f+"*/"?confirm("Requested: '"+a.uri+"' with checksum: "+f+" but received: "+l.substring(2,f.length)+"instead. Attempt to refresh the application?")&&M():e(j)};(d?L:p)(a.uri,b,c)}}function F(a){var b=a.data,a=a.source.window,c,d,e,f;c=0;for(d=m.length;c<d;c++)if(e=m[c],
f=e.iframe,f.contentWindow===a){e.callback(b);k.body.removeChild(f);m.splice(c,1);break}}function G(a){"undefined"!=typeof console&&(console.error||console.log).call(console,a)}function t(a,b){try{n.setItem(a,b)}catch(c){if(c.code==c.QUOTA_EXCEEDED_ERR&&q){var d=q.assets.map(function(a){return a.key}),e=0,f=n.length,l=!1,j;for(d.push(q.key);e<=f-1;)j=n.key(e),-1==d.indexOf(j)?(n.removeItem(j),l=!0,f--):e++;l&&t(a,b)}}}function u(a){try{return n.getItem(a)}catch(d){return null}}function M(){H||(H=
!0,p(o,function(a){(new s(a)).store();i.location.reload()}))}function w(a){function b(a,d){var b=a.collection,g=a.index,f=b.length,e;a.ready=!0;a.content=d;for(e=g-1;0<=e;e--)if(a=b[e],!a.ready||!a.evaluated)return;for(e=g;e<f;e++)if(a=b[e],a.ready)a.evaluated||c(a);else break}function c(a){a.evaluated=!0;if("js"==a.type)try{eval(a.content)}catch(b){G("Error evaluating "+a.uri+" with message: "+b)}else{var d=k.createElement("style"),c;d.type="text/css";d.textContent=a.content;"id"in a&&(d.id=a.id);
"disabled"in a&&(d.disabled=a.disabled);c=document.createElement("base");c.href=a.path.replace(/\/[^\/]*$/,"/");x.appendChild(c);x.appendChild(d);x.removeChild(c)}delete a.content;0==--f&&h()}function h(){function b(){k&&c()}function c(){var a=r.onUpdated||D;if("onSetup"in r)r.onSetup(a);else a()}function e(){l.store();h.forEach(function(a){t(a.key,a.content)});c()}function g(a,b){a.content=b;0==--m&&(d.status==d.IDLE?e():i=e)}function f(){I("online",f,!1);p(o,function(c){q=l=new s(c);var e;l.assets.forEach(function(b){e=
a.getAsset(b.uri);(!e||b.version!==e.version)&&h.push(b)});m=h.length;0==m?d.status==d.IDLE?b():i=b:h.forEach(function(b){function d(){E(b,function(a){g(b,a)})}var c=a.getAsset(b.uri),e=b.path,f=b.update;!c||!f||null===u(b.key)||"delta"!=f?d():p("deltas/"+e+"/"+c.version+".json",function(a){try{var d=b,c;var e=u(b.key),f=B(a),a=[],h,j,i;if(0===f.length)c=e;else{j=0;for(i=f.length;j<i;j++)h=f[j],"number"===typeof h?a.push(e.substring(h,h+f[++j])):a.push(h);c=a.join("")}g(d,c)}catch(k){G("Malformed delta content received for "+
b.uri)}},d)})})}var h=[],k=!1,i=function(){},n=function(){d.swapCache();k=!0;i()},m;I("message",F,!1);if(d.status==d.UPDATEREADY)n();else if(d.status==d.CHECKING||d.status==d.DOWNLOADING)d.onupdateready=n,d.onnoupdate=d.onobsolete=function(){i()};!1!==navigator.onLine?f():y("online",f,!1)}var e=a.assets,f=e.length,l;q=a;y("message",F,!1);0==f?h():e.forEach(function(a){var c=u(a.key);null===c?E(a,function(c){a.remote||t(a.key,c);b(a,c)},function(){b(a,"")}):b(a,c)})}function J(a){null!==k.readyState.match(/interactive|complete|loaded/)?
w(a):y("DOMContentLoaded",function(){navigator.standalone?setTimeout(function(){setTimeout(function(){w(a)},1)},1):w(a)},!1)}var D=function(){},m=[],k=i.document,x=k.head,y=i.addEventListener,I=i.removeEventListener,n=i.localStorage,d=i.applicationCache,B=JSON.parse,A=k.createElement("a"),z=k.location,C=z.origin+z.pathname+z.search,o="app.json",H=!1,q;if("undefined"===typeof r)var r=i.Ext={};r.blink=function(a){var b=u(a.id+"-"+C+o);v("viewport","user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi");
v("apple-mobile-web-app-capable","yes");v("apple-touch-fullscreen","yes");b?(a=new s(b),J(a)):p(o,function(b){a=new s(b);a.store();J(a)})}})(this);;Ext.blink({"id":"ba7734f5-ef3e-4477-bcea-70fb8b8a9663"})
    </script>
The result is, I'll have the Sencha loader (appLoadingIndicator) appear, but the ST2 won't load.

I also check if there is no javascript errors with Ripple but everything looks fine.

I suppose there is a way to call the app.js code after being sure Phonegap is ready, but unfortunately I haven't been able to find it.

Thanks for your help !

Ocelyn