跨平臺移動應用開發平臺, 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