Cordova事例

Cordova例子
官方文档:http://cordova.apache.org/docs/zh/3.5.0/index.html
命令详解: http://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html#The%20Command-Line%20Interface
一些部署和配置参考: http://panyongzheng.iteye.com/blog/2157846
Cordova 3.x 基础(8) -- 几个不可或缺的lib  http://rensanning.iteye.com/blog/2021720
中文引导: http://inching.org/2014/06/04/cordova-tutorial/
Cordova 3.x 基础(1) -- 环境搭建(Windows / Android) http://rensanning.iteye.com/blog/2016364


安装和创建例子

1. sudo yum -y install npm
2. sudo npm install -g cordova
3. cordova create hello com.example.hello HelloWorld
4. cordova platform add android
5. cordova platform rm android //删除某个平台的代码
6. cordova build //编译,
     A: cordova build ios
     B: cordova prepare ios
        cordova compile ios
7. cordova emulate android 或者 cordova run --emulator android  //运行到svd
8. cordova android  或者 cordova run android  //运行到手机
9. cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git 或者  cordova plugin add org.apache.cordova.dialogs  //增加插件,到工程根目录执行


官方插件:
1. org.apache.cordova.dialogs  用于实现alret,confim等方法
2. org.apache.cordova.console 实现输出调试信息




PhoneGap/Cordova3.0+ 使用,以及添加插件笔记 http://blog.csdn.net/u012146107/article/details/12852895
添加org.apache.cordova.dialogs插件例子:用于实现alret,confim等方法。,祥解: http://plugins.cordova.io/#/package/org.apache.cordova.dialogs
1.  cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git //增加插件,到工程根目录执行
2. 在index.js的app对象里面加入
alertDismissed: function () {
        // do something
    },
    showAlert: function () {
        navigator.notification.alert(
            'You are the winner!',  // message
            app.alertDismissed,         // callback
            'Game Over',            // title
            'Done'                  // buttonName
        );
    }

3. 在index.html加入
<p><a href="#" onclick="app.showAlert();return false;">点链接</a></p>



调试方式:
1. GapDebug
2. Mock 模式调试技术


问题:
1. jquery mobile中图标不显示问题 http://blog.csdn.net/wlsyn/article/details/9969487
下载Latest stable版本,把images和css文件放到同一路径。
引入:
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.5.min.css"/>
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.theme-1.4.5.min.css"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script></script>