Before this blog has been "building cross-platform App:jquery mobile app Combat" a book. Popular with mobile development beginners.
From now on, the serial of its twin sister book PhoneGap Mobile application of the book, I hope the former is small white you, has become a great white.
What the API in 3.6 PhoneGap can do
This chapter mainly introduces the preparation before PhoneGap development, so now is it time to introduce some things about phonegap? In fact, PhoneGap is a page that is written in HTML. Then you get a few sets of data through specific JavaScript.
Although the use of phonegap for development is mainly based on the knowledge of HTML. But for a phonegap developer, the most basic 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 is the general sense of gravity in people's mouths. It can be used to get the acceleration of the phone in all directions.
For example, it is possible to use the gravitational acceleration of about 10 to get the current direction of the phone. It can be used in some games and some algorithms to achieve somatosensory operation (such as simulating the operation of the user on the steering wheel).
2. Camera (webcam)
Camera as it literally means. The ability to get the information from the camera collection. It's just generally not very useful.
3. Capture (Collection Tool)
Capture is similar to a tape recorder or VCR. It can be used to record audio or video or to upload images to the network. It also enables you to obtain multimedia information from the network. Capture is used in a number of social applications. such as Renren's upload image function can rely on it to simple implementation.
4..Compass (Compass)
Assuming that the accelerometer is used to sense gravity and know the direction of the ground, the compass is able to get the direction of the east, which can be accomplished by using it with the accelerometer and geolocation sensors to achieve some of the most amazing features, such as knowing the user's location from the photo currently being taken by the user.
This sounds very fantasy. But it is not impossible to achieve. The information obtained from the location sensor indicates that the user is on the beach, and the compass proves that the user is facing the sea, so that it is possible to infer the content of the photo taken by the user without even having to analyze the contrast slice.
5. Connetion (Network connection)
Connetion can infer the network state that the user is in. Personally feel a little chicken.
6. Contts (Contact person)
Contts is a 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, operating system, and so on.
8. Events (System events)
Events is a callback function that responds to system time, such as giving notifications when the user is low on power, and responding to functions such as volume keys or search keys.
9. File (document management System)
It is possible to manage files on the phone through file, but because of the operational efficiency of PHONEGAP, it is not recommended that readers try to develop a file manager or even a simple e-book reader.
It is still possible to use file in your app to do some simple things (such as saving some messages or notes in txt).
10. Geolocation (location sensor)
Geolocation is a GPS that is commonly used by users. A feature that is often used in social software is typically used in conjunction with other sensors.
11. Media (Medium)
Media is used to record and play audio files, and it's not as useful as a collection tool, so it's also more chicken-like.
12. Notification (Reminder)
Notification can invoke functions such as vibration and buzzer of the device. Generally used to achieve feedback on user operations, such as in the game when the user crashes after a series of shocks.
13. Storage (Local storage)
Storage is a useful set of APIs that enable you to use simple database functions locally, and to cache information such as news or chat records in real-world development.
The availability of phonegap is getting higher. Low entry thresholds enable you to write less code to create a mobile-friendly interface. "Building cross-platform App:phonegap mobile Application Practice" This book uses an example-driven approach to introduce the app development under PhoneGap, which provides more than 20 practical cases to teach readers to develop mobile, and finally through 3 small projects to review and consolidate the knowledge points.
PhoneGap, "Building cross-platform APP:PHONEGAP mobile Applications" serial one (API in PhoneGap)