PhoneGap, "Building cross-platform APP:PHONEGAP mobile Applications" serial one (API in PhoneGap)

Source: Internet
Author: User

Before this blog has been "building cross-platform App:jquery mobile app Combat" book, by the mobile development of the Novice's favorite.

From now on, the serial of its twin sister book PhoneGap Mobile application of a book, Hope once was small white you, has become the great white.

What the API in 3.6 PhoneGap can do

This chapter mainly introduces the preparation before PhoneGap development, so is it time to introduce some things about phonegap? In fact, PhoneGap is the page that is written in HTML, and then through the specific JavaScript to get a few sets of data.

Although the use of phonegap for development is mainly based on the knowledge of HTML, but for a phonegap developer, the most important thing is to phonegap the use of various APIs. PHONEGAP provides developers with API interfaces for battery status, cameras, contacts, file systems, audio, and more, this section describes their functionality and purpose.

1. Accelerometer (acceleration sensor)

Accelerometer, which is the general sense of gravity in people's mouths, can be used to get acceleration in all directions of a cell phone. For example, you can use the gravitational acceleration of about 10 to get the current direction of the phone, you can use it in some games and some algorithms to achieve somatosensory operation (such as analog user to the steering wheel operation).

2. Camera (webcam)

Camera as it literally means, it can be used to get the information captured by the camera, but generally not very useful.

3. Capture (Capture tool)

Capture is similar to a tape recorder or VCR, which can be used to record audio or video or to upload images to a network, or to obtain multimedia information from the network. Capture is used in some social applications, such as Renren's upload image function can rely on it to simple implementation.

4..Compass (Compass)

If the accelerometer is used to sense gravity so that it knows the ground direction, then the compass can get the direction of the east, it can use the accelerometer, location sensor to achieve some of the most magical functions, such as from the user is currently taking photos to know the user's location.

This sounds very fantasy, but it is not impossible to achieve, such as the information obtained from the location sensor indicates that the user is on the beach, and the compass can prove that the user is facing the sea, so it is not even necessary to analyze the photos to determine the content of the photos taken by the user.

5. Connetion (Network connection)

Connetion is only able to judge the user's network status, personal feeling some chicken.

6. Contts (Contact person)

Contts is a very useful set of APIs for adding, deleting, changing, and checking the contacts on the device.

7. Device (Get equipment information)

Device can obtain information such as version number, operating system, and so on.

8. Events (System events)

Events are callback functions that respond to system time, such as notifications when the user is low on power, or the ability to respond to functions such as volume keys or search keys.

9. File (document management System)

You can use file to manage files on your phone, but because of the efficiency of phonegap, it is not recommended that readers try to develop a file manager, or even a simple ebook reader. It is still possible to use file in your app to perform some simple operations on files (such as saving some messages or notes in txt).

10. Geolocation (location sensor)

Geolocation is a common feature of GPs, which is commonly used by users, and usually works in conjunction with other sensors.

11. Media (Medium)

Media is used to record and play audio files, it is not as practical as the collection tool, so it is also more chicken.

12. Notification (Reminder)

Notification can invoke the device's vibration and buzzer functions, commonly used to achieve user feedback, such as in the game when the user crashes after the start of a series of vibrations.

13. Storage (Local storage)

Storage is a very useful set of APIs that allow you to use simple database functions locally, and in real-world development, you can cache information such as news or chat logs.

PhoneGap availability is getting higher, the entry threshold is low, and you can write less code to create a mobile-friendly interface. "Building cross-platform App:phonegap mobile Application Practice" This book uses an instance-driven approach to introduce the app development under PhoneGap, which provides more than 20 practical cases to teach readers to move development, and finally through 3 small projects to review and consolidate the knowledge points.

Interested in learning the serial of jquery Mobile can look at:


PhoneGap, "Building cross-platform APP:PHONEGAP mobile Applications" serial one (API in PhoneGap)

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: 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.