本文介绍了deviceready没有发生在phonegap 2.9.0与sencha touch 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PhoneGap 2.9.0和SenchaTouch来开发我的Android应用程序(targetSdkVersion 16)。



当我在Chrome中启动应用时,我收到了这样的日志:

 由于缺少_cordovaNative,因此回退到PROMPT模式。预计只适用于Android 3.2及更低版本。 cordova.js:912 
deviceready 5秒钟后没有发射。 cordova.js:6725
频道未触发:onCordovaConnectionReady cordova.js:6718
频道未触发:onCordovaInfoReady cordova.js:6718

当我在三星平板电脑(Android 4.1.2)上测试时,第一行消失了,但3个事件总是未触发。


$ b $



这里是index.html的头部:

 < head> 
< meta charset =UTF-8>
< title> title< / title>

<! - 以下行必须保持完整,Sencha Command才能构建您的应用程序 - >
< script id =microloadertype =text / javascriptsrc =touch / microloader / development.js>< / script>

< style type =text / css>
一些css here
< / style>

< script type =text / javascriptcharset =utf-8src =pg / cordova.js>< / script&
< script type =text / javascriptcharset =utf-8src =pg / barcodescanner.js>< / script>

< / head>

我使用一些phonegap API,如Camera和File。由于PhoneGap接收从不deviceready事件,API不可用,因此navigator.camera未定义。



我做了一个拥抱的研究,但我测试的都没有解决问题。任何建议欢迎
提前感谢

解决方案

有同样的问题,但在我的情况下,事实上,我已经引用我的config.xml中的插件,我没有在我的应用程序中实例化。



只要注释它们,直到我在代码中引用他们,



感谢:


I use PhoneGap 2.9.0 and SenchaTouch to develop my Android application (targetSdkVersion 16).

When I start the app in Chrome, I got such logs :

Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only. cordova.js:912
deviceready has not fired after 5 seconds. cordova.js:6725
Channel not fired: onCordovaConnectionReady cordova.js:6718
Channel not fired: onCordovaInfoReady  cordova.js:6718

When I test it in Samsung tablet (Android 4.1.2), the first line disappeared but the 3 events are always not fired.

However, it seems SenchaTouch works quite good: views display and interactions works as I expect.

Here's the head section of index.html:

 <head>
    <meta charset="UTF-8">
    <title>title</title>

    <!-- The line below must be kept intact for Sencha Command to build your application -->
    <script id="microloader" type="text/javascript" src="touch/microloader/development.js"></script>

    <style type="text/css">
       some css here
    </style>

    <script type="text/javascript" charset="utf-8" src="pg/cordova.js"></script>
    <script type="text/javascript" charset="utf-8" src="pg/barcodescanner.js"></script>

 </head>

I use some phonegap API such as Camera and File. As PhoneGap receives never deviceready event, the API is not available so navigator.camera is undefined.

I did a hug research but all I tested does not resolve the problem. Any advice is welcomeThanks in advance

解决方案

Had the same issue, but in my case it was due to the fact that I have referenced plugins in my config.xml which I have not instantiated within my application.

Simply commenting them out until I referenced them in my code gave me an immediate "Phonegap is ready".

Thanks goes to: http://community.phonegap.com/nitobi/topics/deviceready_has_not_fired_after_5_seconds

这篇关于deviceready没有发生在phonegap 2.9.0与sencha touch 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:58