jQuery Mobile Phonegap Cordova事件无法正常工作并触发 [英] jQuery Mobile Phonegap Cordova Events not working and Firing

查看:91
本文介绍了jQuery Mobile Phonegap Cordova事件无法正常工作并触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们必须使用HTML5构建移动应用程序,然后才能在Android和IOS上使用。
我们首先使用jQuery Mobile Framework管理页面和操作。问题是当我们使用Apache Cordova API时,从设备(如uuid)获取一些信息,并管理退出应用程序按钮,没有任何作用!...
我们使用从获取的Cordova脚本href = https://code.google.com/p/js-addin/issues/attachmentText?id=29&aid=290000000&name=cordova-2.5.0.js&token=0Y9Obv319QqouAEi8l1bslaDZQo%3A1396628304815 rel = nofollow> Google链接
在构建应用程序pn电话间隙之前,我们将以下行放入config.xml文件:

We have to build a mobile application using HTML5, to be worked on Android and IOS. We started by using jQuery Mobile Framework to manage the pages and actions.Every thing is fine. The problem is when we use the Apache Cordova API, to get some info from the device like the uuid, and manage an Exit Application Button, nothing working!... We use the Cordova Script which get from this Google Link. We put the line below into the config.xml file before building the app pn phonegap:

<plugin name="Notification" value="org.apache.cordova.notification.Notification" />

我们使用Cordova Phonegap提供的官方文档网站,如下:

We use the official documentation presented From Cordova Phonegap Site , which is below:

 <!DOCTYPE html>
<html>
  <head>
    <title>Notification Example</title>

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

    // Wait for Cordova to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // Cordova is ready
    //
    function onDeviceReady() {
        // Empty
    }

    // alert dialog dismissed
    function alertDismissed() {
        // do something
    }

    // Show a custom alertDismissed
    //
    function showAlert() {
        navigator.notification.alert(
            'You are the winner!',  // message
            alertDismissed,         // callback
            'Game Over',            // title
            'Done'                  // buttonName
        );
    }

    </script>
  </head>
  <body>
    <p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>
  </body>
</html>

但是在构建Android平台的源代码之后没有发生任何事情。没有事件触发或任何与phonegap相关的事件!

But any thing not happened after building the sources to the Android Platform. No Events fired or anything related to phonegap!

我们正在搜索许多结果和建议来解决该问题,但没有任何结果!

We have searching many results and suggestions to resolve that but without any results!

该应用程序已在Android 4.3上进行了测试。

The applications has been tested on Android 4.3.

感谢您的建议。

推荐答案

使用cordova 2.9.0和上装罐可以解决此问题。

Using cordova 2.9.0 and upper cans resolve this issues.

这些行需要放入config.xml文件中:

theses lines are needed to put in the config.xml file:

<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />  // android
<param name="ios-package" value="CDVDevice" /> IOS
</feature>
<!-- -->
<plugins>
<plugin name="App" value="org.apache.cordova.App" />
<plugin name="Device" value="org.apache.cordova.Device" />
<plugin name="Device" value="CDVDevice" />
</plugins>
<!-- phonegap plugins -->
<gap:plugin name="org.apache.cordova.console" />
<gap:plugin name="org.apache.cordova.device" version="0.2.8" />
<gap:plugin name="org.apache.cordova.dialogs" />

这篇关于jQuery Mobile Phonegap Cordova事件无法正常工作并触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆