Phoegap (Cordova) development of HelloWorld for cross-platform apps

Source: Internet
Author: User

PhoneGap ( Cordova ) of Hellworld program

1 Installing the JDK Configuration environment variables:

2 Installing the ANDROID-SDK configuration environment variable:

Set Path=e:\android-sdk\platform-tools; E:\android-sdk\tools;

3 Installing Git.exe Configuring environment variables

Set Path=e:\program Files\git\cmd

4 Installing the Apache-ant-??? -bin.zip Configuring environment variables

Set Path=c:\apache-ant\bin;

5 Installing Eclipse

6 Installing PhoneGap

Download Nodejs

NPM install–g phonegap (online installation)

Establishment of the Helloword program:

1 Create a new folder to store Android programs such as: PG

2 CD PG If you want to switch to e-drive, direct e: Enter

PHONEGAP Create photos (folder name) Com.itcast (package name) project name

Cd Photos

Phonegap build Android This step will create an Android folder in platforms under the Photos folder, this is our Android project, there are other Platform SDK, can also create other platform projects, The corresponding folder for other projects will also be generated

3 Assets's WWW folder is a Web page.

What is generated after the Bin is compiled

Ccordova PhoneGap's library file

Gen Static resource file

Libs

Platform_www. js file

There is an XML folder in the Res resource file with a. config file below

Note Configuration: <access origin= "*"/>

Later, if you want to use some of the system's hardware features, you should configure the appropriate

Plugin (described later)

SRC Source Code

Androidmanifest.xml System-level configuration file configuration permissions are critical

4 Open the project we created in eclipse (if you find a garbled problem, click the encoding setting under Project-->properties)

In the new project platforms, the Android project is open.

Eclipse will automatically load these plug-ins run prompts for the deployed device to be selected

If you find that you cannot open the WWW folder and the. config file in res in eclipse, select files

In the resource property of the resource filters set its property to null

5 Open www Web site in vs save after editing and editing

6 Eclipse F5 Refresh

7 Use PhoneGap to refer to PhoneGap. JS file

8 after phoegap3.0 all the plugins are to be under their own

Because plug-ins need to configure permissions, a plugin will need to open a permission

So you need that plugin to configure this plugin yourself

There are two ways to configure plug-ins:

1 directly on the Internet to find all the plug-in packages themselves, more complex, it is not recommended to use this method

2 in the directory of the PHONEGAP project that you set up, execute the command, note that the execution of these commands must be networked, PHONEGAP will automatically help us to configure the corresponding files in the project

Basic device information (device API):

PhoneGap Plugin Add Org.apache.cordova.device

Network Connection and Battery Events:

PhoneGap Plugin Add org.apache.cordova.network-information

PhoneGap Plugin Add Org.apache.cordova.battery-status

Accelerometer, Compass, and geolocation:

PhoneGap Plugin Add org.apache.cordova.device-motion

PhoneGap Plugin Add org.apache.cordova.device-orientation

PhoneGap Plugin Add org.apache.cordova.geolocation

Camera, Media playback and Capture:

PhoneGap Plugin Add Org.apache.cordova.camera

PhoneGap Plugin Add org.apache.cordova.media-capture

PhoneGap Plugin Add Org.apache.cordova.media

Access files on device or network (File API):

PhoneGap Plugin Add Org.apache.cordova.file

PhoneGap Plugin Add Org.apache.cordova.file-transfer

Notification via dialog box or vibration:

PhoneGap Plugin Add Org.apache.cordova.dialogs

PhoneGap Plugin Add org.apache.cordova.vibration

Contacts:

PhoneGap Plugin Add org.apache.cordova.contacts

Globalization:

PhoneGap Plugin Add org.apache.cordova.globalization

SplashScreen:

PhoneGap Plugin Add Org.apache.cordova.splashscreen

Open new browser windows (Inappbrowser):

PhoneGap Plugin Add Org.apache.cordova.inappbrowser

Debug Console:

PhoneGap Plugin Add Org.apache.cordova.console

9 Packaging after development is complete:

precautions must be the outermost WWW folder with the Android project in the Assests folder under the

The content in the WWW folder is the same

Ten DOS switch to PhoneGap project, execute PhoneGap build Android on Android project Ant-build

folder will have the corresponding Android apk

Phoegap (Cordova) development of HelloWorld for cross-platform apps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.