phonegap Overview

PhoneGap 和 Cordova的关系阐述

是PhoneGap贡献给Apache后的开源项目,是从PhoneGap中抽出的核心代码,是驱动PhoneGap的核心引擎。你可以把他想象成类似于Webkit和Google Chrome的关系。

Apache Cordova is an open-source mobile development framework. It allows you to use standard web technologies such as HTML5, CSS3, and JavaScript for cross-platform development, avoiding each mobile platforms‘ native development language. Applications execute within wrappers targeted to each platform, and rely on standards-compliant API bindings to access each device‘s sensors, data, and network status.

Apache Cordova graduated in October 2012 as a top level project within the Apache Software Foundation (ASF). Through the ASF, future Cordova development will ensure open stewardship of the project. It will always remain free and open source under the Apache License, Version 2.0. Visit cordova.apache.org for more information.

Use Apache Cordova if you are:

  • a mobile developer and want to extend an application across more than one platform, without having to re-implement it with each platform‘s language and tool set.
  • a web developer and want to deploy a web app that‘s packaged for distribution in various app store portals.
  • a mobile developer interested in mixing native application components with a WebView (browser window) that can access device-level APIs, or if you want to develop a plugin interface between native and WebView components.

Basic Components

Apache Cordova applications rely on a common config.xml file that provides information about the app and specifies parameters affecting how it works, such as whether it responds to orientation shifts. This file adheres to the W3C‘s Packaged Web App, or widget, specification.

The application itself is implemented as a web page, named index.html by default, that references whatever CSS, JavaScript, images, media files, or other resources are necessary for it to run. The app executes as a WebView within the native application wrapper, which you distribute to app stores.

The Cordova-enabled WebView may provide the application with its entire user interface. On some platforms, it can also be a component within a larger, hybrid application that mixes the WebView with native application components. (See Embedding WebViews for details.)

A plugin interface is available for Cordova and native components to communicate with each other. This enables you to invoke native code from JavaScript. As of version 3.0, plugins provide bindings to standard device APIs. Third-party plugins provide additional bindings to features not necessarily available on all platforms. You can find these third-party plugins in the plugin registry and use them in your application. You can also develop your own plugins, as described in the Plugin Development Guide. Plugins may be necessary, for example, to communicate between Cordova and custom native components.

Development Paths

As of version 3.0, you can use two basic workflows to create a mobile app. While you can often use either workflow to accomplish the same task, they each offer advantages:

  • Cross-platform workflow: Use this workflow if you want your app to run on as many different mobile operating systems as possible, with little need for platform-specific development. This workflow centers around the cordova utility, otherwise known as the Cordova CLI, that was introduced with Cordova 3.0. The CLI is a high-level tool that allows you to build projects for many platforms at once, abstracting away much of the functionality of lower-level shell scripts. The CLI copies a common set of web assets into subdirectories for each mobile platform, makes any necessary configuration changes for each, runs build scripts to generate application binaries. The CLI also provides a common interface to apply plugins to your app. For more details on the CLI, see The Command-Line Interface. Unless you have a need for the platform-centered workflow, the cross-platform workflow is recommended.
  • Platform-centered workflow: Use this workflow if you want to focus on building an app for a single platform and need to be able to modify it at a lower level. You need to use this approach, for example, if you want your app to mix custom native components with web-based Cordova components, as discussed in Embedding WebViews. As a rule of thumb, use this workflow if you need to modify the project within the SDK. This workflow relies on a set of lower-level shell scripts that are tailored for each supported platform, and a separate Plugman utility that allows you to apply plugins. While you can use this workflow to build cross-platform apps, it is generally more difficult because the lack of a higher-level tool means separate build cycles and plugin modifications for each platform. Still, this workflow allows you greater access to development options provided by each SDK, and is essential for complex hybrid apps. See the various Platform Guides for details on each platform‘s available shell utilities.

When first starting out, it may be easiest to use the cross-platform workflow to create an app, as described in The Command-line Interface. You then have the option to switch to a platform-centered workflow if you need the greater control the SDK provides. Lower-level shell utilities are available at cordova.apache.org in a separate distribution than the CLI. For projects initially generated by the CLI, these shell tools are also available in the project‘s various platforms/*/cordova directories.

NOTE: Once you switch from the CLI-based workflow to one centered around the platform-specific SDKs and shell tools, you can‘t go back. The CLI maintains a common set of cross-platform source code, which on each build it uses to write over platform-specific source code. To preserve any modifications you make to the platform-specific assets, you need to switch to the platform-centered shell tools, which ignore the cross-platform source code, and instead relies on the platform-specific source code.

Installing Cordova

The installation of Cordova will differ depending on the workflow above you choose:

After installing Cordova, it is recommended that you review the Platform Guides for the mobile platforms that you will be developing for. It is also recommended that you also review the Privacy Guide, Security Guide, and Next Steps. For configuring Cordova, see The config.xml File. For accessing native function on a device from JavaScript, refer to the Plugin APIs. And refer to the other included guides as necessary.

时间: 2024-10-25 02:43:59

phonegap Overview的相关文章

移动应用跨平台开发:《用PhoneGap来开发跨平台手机应用》

移动应用跨平台开发:<用PhoneGap来开发跨平台手机应用> 随着HTML5, CSS3, Javascript的发展,以及浏览器对这些特性的支持,使得手机跨平台成为一种趋势,跨平台意味着:开发一次,到处运行.基于(HTML5, CSS3, Javascript)的前端开发技术,可以通过PhoneGap(http://phonegap.com/)来生成对应设备的应用,如Android的APK, iOS设备的ipa等.相比原生态的应用来讲,PhoneGap开发出来的应用成本更低,甚至不需要会J

phonegap环境配置与基本操作

一.开发环境配置: 1.工具环境安装: 安装java sdk 1.6以上版本,Android Development Tools.ant,系统变量 Path后面添加 新增名稱 JAVA_HOME 值為 JAVA 安裝路徑 C:\Program Files\Java\jdk1.7.0_21 新增名稱 ANT_HOME 值為 ANT 安裝路徑 C:\Program Files (x86)\apache-ant-1.9.3 修改 Path 屬性的值 保留原本的值,在原本的後面加上;%JAVA_HOME

构建通过 Database.com 提供技术支持的 PhoneGap 应用程序

要求 其他必要产品 Database.com account 用户级别 全部 必需产品 PhoneGap Build 范例文件 Database.Com-PhoneGap-Sample 在这篇文章中,我们将探究使用 PhoneGap 构建的移动应用程序的创建过程,所有数据 均通过 Database.com 提供并保存.在深入探讨技术细节之前,我们先来回顾一下相关术语. PhoneGap PhoneGap 是一种免费的开放源码技术,旨在使开发人员使用基于 Web 的传统技术,创建能够在多个平台上进

Phonegap(Cordova)3.4 + Android 环境搭建

PhoneGap是一个用基于HTML,CSS和JavaScript的,创建移动跨平台移动应用程序的快速开发平台.它使开发者能够利用iPhone,Android,WP7等多种智能手机的核心功能--包括地理定位,加速器,联系人,声音和振动等,此外PhoneGap拥有丰富的插件,可以以此扩展无限的功能. PhoneGap最初由Nitobi开发, 它被Adobe收购后,PhoneGap项目也被贡献给Apache软件基金会,并改名为 Apache Cordova. 目前最新版本:3.4.1 . Phone

使用The PhoneGap Developer App实现快速调试项目

如今,基于 PhoneGap 的混合 APP 开发技术更加成熟,优势更加凸显.移动互联网的迅猛发展,Android 和 iOS 的版本快速迭代,使 HTML5 的性能问题逐步解决.仅仅在 PhoneGap 官网上,已经有来自第三方开发者提交的数百项插件,涵盖了 APP 开发的各个方面,大大扩展了 PhoneGap 的功能体系. PhoneGap 官方推出了新的调试工具 The PhoneGap Developer App .这是一款由 PhoneGap 开发的APP ,安装在手机上后,可以通过

PhoneGap+Cordova+SenchaTouch-04-退出程序和对话框的使用

sencha touch 2.4.1对话框的使用是很简单的. 下面简单介绍下st对话框的使用,查看官方文档,在Ext.Msg中,找到show 方法,有个示例挺好 图1 按着示例做就搞定了! 我的代码如下,也是示例. Ext.Msg.confirm("Confirmation", "Are you sure you want to do that?", Ext.emptyFn); 效果图如下: 这里,我想把按钮等英文改为中文,查看文档,可以看到Ext.Msg有个but

为PhoneGap写一个android插件

为PhoneGap写一个android插件,要怎么做? 其实这句话应该反过来说,为android写一个PhoneGap插件,要怎么做? 这里以最简单的Hello World!为例,做个说明: 1.第一步,要先建立一个支持PhoneGap(Cordova)的android工程 因为这个插件本质上是安卓插件,用于PhoneGap,因此,要二者支持才行,所以我们要建立一个支持PhoneGap(Cordova)的android工程,插件在这个工程里面编写. 扫盲:PhoneGap现在已经出售给了Apac

我的第一个phonegap开发WebApp的demo 怎么搭建安卓开发环境以及安装phonegap

一.先来张图,赏心悦目观赏一下,哈 . 这个就是使用phonegap框架搭建起来的,运行在安卓环境上的第一个demo. 安卓的开发环境,大家都会搭建了,所以不赘述.讲一下,安装phonegap的步骤. 二.phonegap的安装   1. 设置系统变量系统变量 Path后面添加:(以下变量都是必须的,路径根据自己的设置)E:\android_sdk\sdk\tools;E:\android_sdk\sdk\platform-tools;E:\android_sdk\eclipse\plugins

安装配置PhoneGap开发环境(一)

1 安装JDK 略. 2 安装Eclipse并安装ADT插件 Android的官网提供集成了Android插件的Eclipse开发环境. 眼下訪问不了,尝试百度一下其他资源. 3 安装Android SDK最新版本号 眼下最新版本号为API 22. 4 安装Node.js 到Node.js官网下载并安装Node.js. 5 安装PhoneGap.Cordoba Node.js成功安装后,将其路径配入Path环境变量.以方便命令行使用.在命令行中输入: npm install -g phonega