Web multi-terminal development and learning series (II)-hardware interaction framework Phonegap learning and framework phonegap

Source: Internet
Author: User

Web multi-terminal development and learning series (II)-hardware interaction framework Phonegap learning and framework phonegap

Currently, mobile and desktop platforms have their own development languages and tools. If we want to develop a system that is compatible with multiple terminals, we need to use their own platform tools to develop their respective applications, which is extremely demanding for a team or a developer, and time-consuming. The previous article learned about the Bootstrap framework and provided a solution for multi-Terminal interface adaptation. However, in addition to interaction with users, a system may also need to interact with hardware to meet certain special requirements, such as camera calls and album acquisition. We can select Phonegap for calling these hardware.

Introduction Phonegap is a framework adapted to multiple terminals for hardware interaction, I use the version is phonegap-2.9.0, supported platforms include Android, Blackberry, IOS, Tizen, WinPhone7 and 8, win8 .. Of course, the platform supported by a special function may be different. For details, refer to the official documentation. The official phonegap website is http://phonegap.com /. Different initial environments are required for different platforms. For example, android needs to import jar packages and configure the initial XML. Once these environments are configured, multiple platforms can access the same Html or dynamic web page to achieve hardware interaction with each platform.
Environment build official website download phonegap-2.9.0, I download by manually download ZIP, unzip. The platform used in this example is android, and the construction of other platforms is similar. Examples provided on the official website .. \ Phonegap-2.9.0 \ lib \ android \ exampleImport it to eclipse. The project structure is as follows: assets stores the JS Code of the actually called hardware, and config. xml is the configuration file. You can use config. xml to configure the class library for hardware calling and the initial access path of the program.
Instance .. \ Phonegap-2.9.0 \ doc stores various API instances for phonegap. For details, refer to this document.
For example, if you need to call the android camera through js, the steps are as follows: 1. Configure the access permission for AndroidManifest. xml
    <uses-permission android:name="android.permission.CAMERA" />
2. config. xml introduce class library
    <feature name="Camera">      <param name="android-package" value="org.apache.cordova.CameraLauncher"/>    </feature>
3. Actual js call
Summary if you need to use phonegap to develop the system, you must configure the basic environment for each target platform. Once the basic environment is ready, you can perform unified code development. Because of the cross-platform framework and cross-language calls, the performance of applications developed by phonegap is still different from that of native applications. However, for common applications, normal hardware can basically ignore this gap.

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.