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

关于meta viewport中target-densitydpi属性 http://blog.csdn.net/fengri5566/article/details/9414599

phonegap在android中如何退出程序 http://blog.sina.com.cn/s/blog_6d3fcc7e0101ddmz.html

官方插件:
1. cordova plugin add org.apache.cordova.dialogs  用于实现alret,confim等方法
2. cordova plugin add org.apache.cordova.console 实现输出调试信息
3. cordova plugin add org.apache.cordova.inappbrowser 使用内置浏览器打开连接
4. cordova plugin add com.phonegap.plugins.barcodescanner 条形码 https://build.phonegap.com/plugins/261
5. PhonegapOCRPlugin iOS  扫描插件
5. cordova plugin add https://github.com/albertarvesu/image-scanner-cordova-plugin.git   扫描插件

Local Storage API methods.
localStorage.getItem(): Returns the value associated with the key.
localStorage.setItem(): Saves the specified key-value pair.
localStorage.removeItem(): Removes the item associated with the key argument.
localStorage.clear(): Removes all items saved in localStorage.

安装和创建例子

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. ordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git 或者 cordova plugin add org.apache.cordova.dialogs  //增加插件,到工程根目录执行

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对象里面加入

3. 在index.html加入

ajax技术,注意包含编辑头部信息。
服务器:cakephp代码

客户端:

应用图标
http://cordova.apache.org/docs/en/edge/config_ref_images.md.html#Icons%20and%20Splash%20Screens

Xml代码
  1. <icon src=“res/icon.png” platform=“android” width=“57” height=“57” density=“mdpi” />

调试方式:
1. GapDebug, 不支持Linux
2. Mock 模式调试技术, Phonegap-desktop 项目, 一直没更新。
3. 代理模式调试技术weinre, Weinre 无法实现 JavaScript 动态调试
Weinre: http://blog.csdn.net/niuer09/article/details/8795321
sudo npm -g install weinre
weinre –boundHost 192.168.0.198 –httpPort 8081 –all
/usr/lib/node_modules/weinre/web/target/target-script-min.js加入工程

问题:
1.  ANDROID_HOME is not set and “android” command not in your PATH,
明明环境变量都弄好了,执行android也能打开了,为什么还报错?