跨平台移动应用开发平台, PhoneGap CLI 4.2.0 发布
PhoneGap 是一款HTML5平台,通过它,开发商可以使用HTML、CSS及JavaScript来开发本地移动应用程序。因此,目前开发商可以只 编写一次应用程序,然后在7个主要的移动平台和应用程序商店(app store)里进行发布,这些移动平台和应用程序商店包括:iOS、Android、BlackBerry、webOS、bada、Winodws Phone以及Symbian。
它使开发者能够利用iPhone,Android,Palm,Symbian,WP,Bada和Blackberry智能手机的核心功能——包括地理定位,加速器,联系人,声音和振动等,此外PhoneGap拥有丰富的插件,可以以此扩展无限的功能。
下面是一些使用该框架的代码示例:
获取地理位置:
//GAP will invoke this function once it has the location function gotLocation(lat,lon){ $('lat').innerHTML = "latitude: " + lat; $('lon').innerHTML = "longitude: " + lon; }
获取摄像头捕捉的照片
function takePhoto(){ var photo = gap:takePhoto(); return photo; }PhoneGap CLI 4.2.0 发布,此版本现已提供下载:
OS X or Linux
$ npm install -g phonegap
需要使用sudo npm install -g phonegap
Windows
C:\> npm install -g phonegap
此版本包括大量的 PhoneGap 和 Cordova 引擎方面的改进!
当前各平台版本如下:
-
Apache Cordova Amazon-FireOS 3.6.3
-
Apache Cordova Android 3.6.4
-
Apache Cordova BlackBerry10 3.7.0
-
Apache Cordova Browser 3.6.0
-
Apache Cordova FirefoxOS 3.6.3
-
Apache Cordova iOS 3.7.0
-
Apache Cordova Ubuntu 4.0.0
-
Apache Cordova Windows 3.7.1
-
Apache Cordova WP8 3.7.1
PhoneGap 方面的改进:
-
phonegap-cli#491 Add support for spaces in cordova binary execution path
-
phonegap-cli#155 Fix Windows output of phonegap binary name.
-
node-phonegap-build#57 Allow a config.xml defined in the project’s root directory to be uploaded to PhoneGap Build. #47.
-
connect-phonegap#101 Fixes the create method on Windows.
-
connect-phonegap#99 Default unregistered devices to latest Cordova version.
-
connect-phonegap#103 Proxy external requests using node-http-proxy. This approach helps to preserve the original headers and rewrites the location header when provided. This helps to address issues reported in connect-phonegap#74 and phonegap-app-developer#175.
-
connect-phonegap#104 Fixed the broken host header caused by the recent proxy update in #103.
Cordova 方面的改进:
-
安装一个本地插件作为超链接:
phonegap plugin add ~/path/to/phonegap-plugin-example --link
-
安装本地插件时定义搜索路径
phonegap plugin add org.apache.cordova.geolocation --searchpath ~/path/to/search
-
恢复插件时定义搜索路径
phonegap restore plugins --experimental --searchpath ~/path/to/search
-
CB-8154 Improved the platform and plugin fetching logic.
-
CB-8053 On Windows, a plugin can now include a project reference.
-
CB-7610 On Windows, a local plugin can now be installed from any drive letter.
-
CB-7803 Enable adding any platform on any operating system. For example, add the Windows Phone platform on OS X or iOS on Windows.
更多改进请看发行说明。
来自:http://www.oschina.net/p/phonegap