Cordova Environment Construction, construction project, and the realization of photo function

Source: Internet
Author: User

First, configure the environment
1. Configure the Java environment:
Download jdk:http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html for the corresponding system environment
Installing the JDK and configuring environment variables

2. Configure the Android environment:
To prepare for Android development tools:
64-bit system decompression: Adt-bundle-windows-x86_64-20140702.zip
32-bit system decompression: Adt-bundle-windows-x86-20140702.zip
To configure environment variables:
Configure the completion path of the tools directory inside the SDK to path, such as:
D:\eclipse_javaee\sdk_api\android-sdk_r24.1.2-windows\android-sdk-windows\tools;

3, Installation nodejs:http://nodejs.cn/

4, install git support: https://git-scm.com/download (may need to FQ)

5, installation CORDOVA:NPM install-g Cordova

6, Installation Ant:cordova Project packaging is done with ant, so you need to install ant.
: http://ant.apache.org/bindownload.cgi
Configure environment variables (written in path): D:\Program Files\apache-ant-1.9.7-bin\apache-ant-1.9.7\bin;

7, test Environment installation configuration is successful
Java Environment test: java-version
Android Environment test: android-h
Nodejs Environmental test: NODE-V
git environment test: git--version
Ant Environment test: ant-version
Cordova Environmental test: Cordova--version



Ii. Creation of the project
1. New Project:
Cordova Create Hello (path) Com.test.hello (ID) HelloWorld (Entry page)
(Do not write parentheses!) )

2. Directory structure
Core configuration information for Config.xmlcordova
www development directory, HTML5 code writing Place
Plugins introduced by plugins
Platforms the runtime that has been added (running environment)
Hooks Custom Extension Features

3. Add runtime (target platform)
Note: Switch to the root directory of the project
Cordova Platform Add Android

4. Create a native project
Cordova Build Android//compile for Andorid platform only
5, the source of the first glimpse
Index.js
App root object, initialization method Initialize, this method calls the Bindevents method, in which the Deviceready event is monitored (this can be done after this event to use the other plug-ins), The event triggers the callback function Ondeviceready method, enters this method, and then gives the Receivedevent method the concrete processing.

Third, plug-in installation
1. Plugin Documentation
Apache Cordova Documentation (official API document) http://cordova.apache.org/docs/en/latest/
Plugin registry (more plugins)---Plugins.cordova.io
2, install the plug-in
Cordova Plugin Add Cordova-plugin-camera
3, plug-in use
Navigator.camera. Getpicture (Successcallback, Errorcallback, Options);

function Successcallback () {
var image = document.getElementById (' myimage ');
IMAGE.SRC = Imageuri;
}

function Errorcallback (message) {
Alert (' Failed because: ' + message);
}

var options = {
QUALITY:50,
DestinationType:Camera.DestinationType.FILE_URI
}

Cordova Environment Construction, construction project, and the realization of photo function

Related Article

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.