我在使用 Android 2.2 和 2.3.3 avd/phone 时遇到了一个问题,但如果我使用英特尔 atom 图像进行 avd 则不会。我正在使用 phonegap 2.3.0 和 jqm 1.3.0。我错过了页面上的 pageshow 事件,并且我的应用程序损坏了,这意味着导航不再起作用:
03-19 16:09:13.045: I/CordovaLog(2733): Found log level DEBUG
03-19 16:09:13.045: I/CordovaLog(2733): Changing log level to DEBUG(3)
03-19 16:09:13.055: I/CordovaLog(2733): Found preference for useBrowserHistory=true
03-19 16:09:13.055: D/CordovaLog(2733): Found preference for useBrowserHistory=true
03-19 16:09:13.065: I/CordovaLog(2733): Found preference for exit-on-suspend=false
03-19 16:09:13.065: D/CordovaLog(2733): Found preference for exit-on-suspend=false
03-19 16:09:18.395: D/CordovaLog(2733): mobile init
03-19 16:09:20.785: D/CordovaLog(2733): init pgSplash
03-19 16:09:20.995: D/CordovaLog(2733): page before show: pgSplash
03-19 16:09:21.285: D/CordovaLog(2733): pageshow : pgSplash
03-19 16:09:21.355: D/CordovaLog(2733): init
03-19 16:09:22.035: D/CordovaLog(2733): Falling back on PROMPT mode since _cordovaNative is missing.
03-19 16:09:22.285: D/CordovaLog(2733): device ready
03-19 16:09:22.295: D/CordovaLog(2733): check version
03-19 16:09:23.795: D/CordovaLog(2733): init pgLogin
03-19 16:09:24.045: D/CordovaLog(2733): page before show: pgLogin
它缺少 pgLogin 的 pageshow 事件并且导航被破坏。我绑定:
$('[data-role=page]').live('pageshow', function (event, ui) {
lastPage = $.mobile.activePage.attr('id');
console.log('pageshow : ' + lastPage);
...
});
正如您在日志中看到的,我从 jqm 获得移动初始化事件,我从 phonegap 和第一页获得设备就绪事件:pgSplash 触发所有事件:初始化、显示前页面、页面显示。但在那之后它就坏了。在 4.1 模拟器 /galaxy 选项卡设备上它可以正常工作。