HTML5 Mobile Development Road (--PHONEGAP) build Android development environment

Source: Internet
Author: User

This paper is the official HTML5 training course for Brother Lian it education organization, mainly introduces: HTML5 Mobile Development Road (--PHONEGAP) building of Android development environment

For the construction of the JDK and Android development environment See my previous blog post: http://blog.csdn.net/dawanganban/article/details/9748497

First, download PhoneGap

: http://phonegap.com/install/i downloaded the latest phonegap 2.9.1

Unzip the downloaded PhoneGap and you can see that there is a example

650) this.width=650; "Src=" http://img.blog.csdn.net/20140114220551281?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvzgf3yw5nyw5iyw4=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "style=" border:0px; "/>

Second, build the environment

1, refer to this example we create our project, and in the assets directory under the new WWW directory, in the Res directory to create an XML directory (directly copy the directory in the example)

650) this.width=650; "Src=" http://img.blog.csdn.net/20140114220345312?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvzgf3yw5nyw5iyw4=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "style=" border:0px; "/>

2. Add Cordova-2.9.0.jar under the Libs directory

650) this.width=650; "Src=" http://img.blog.csdn.net/20140114221026265?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvzgf3yw5nyw5iyw4=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "style=" border:0px; "/>

3, modify mainactivity as follows

[Java] view plain copy

Print? 650) this.width=650; "src=" Https://code.csdn.net/assets/CODE_ico.png "alt=" on Code View "Width=" "height=" 12 " Style= "border:0px;"/>650) this.width=650; "src=" Https://code.csdn.net/assets/ico_fork.svg "alt=" Derivation to My Code slice " Width= "height=" style= "border:0px;"/>

  1. Package com.example.hellomobile;

  2. Import Android.os.Bundle;

  3. Import android.app.Activity;

  4. Import Android.view.Menu;

  5. Import org.apache.cordova.*;

  6. Public class Mainactivity extends Droidgap {

  7. @Override

  8. public void OnCreate (Bundle savedinstancestate) {

  9. super.oncreate (savedinstancestate);

  10. //setcontentview (R.layout.activity_main);

  11. Super.setintegerproperty ("SplashScreen", R.drawable.splash);

  12. Super.loadurl ("file:///android_asset/www/index.html", 2000);

  13. }

  14. }

4. Add Permissions in Androidmainfest.xml

[HTML] view plain copy

Print? 650) this.width=650; "src=" Https://code.csdn.net/assets/CODE_ico.png "alt=" on Code View "Width=" "height=" 12 " Style= "border:0px;"/>650) this.width=650; "src=" Https://code.csdn.net/assets/ico_fork.svg "alt=" Derivation to My Code slice " Width= "height=" style= "border:0px;"/>

  1. <uses-permission android:name="Android.permission.CAMERA" />

  2. <uses-permission android:name="Android.permission.VIBRATE" />

  3. <uses-permission android:name="Android.permission.ACCESS_COARSE_LOCATION" />

  4. <uses-permission android:name="Android.permission.ACCESS_FINE_LOCATION" />

  5. <uses-permission android:name="Android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />

  6. <uses-permission android:name="Android.permission.INTERNET" />

  7. <uses-permission android:name="Android.permission.RECEIVE_SMS" />

  8. <uses-permission android:name="Android.permission.RECORD_AUDIO" />

  9. <uses-permission android:name="Android.permission.RECORD_VIDEO" />

  10. <uses-permission android:name="Android.permission.MODIFY_AUDIO_SETTINGS" />

  11. <uses-permission android:name="Android.permission.READ_CONTACTS" />

  12. <uses-permission android:name="Android.permission.WRITE_CONTACTS" />

  13. <uses-permission android:name="Android.permission.WRITE_EXTERNAL_STORAGE" />

  14. <uses-permission android:name="Android.permission.ACCESS_NETWORK_STATE" />

  15. <uses-permission android:name="Android.permission.GET_ACCOUNTS" />

  16. <uses-permission android:name="Android.permission.BROADCAST_STICKY" />


5. Put the code in the previous article into the WWW directory

Iii. Results of operation

650) this.width=650; "Src=" http://img.blog.csdn.net/20140114221638328?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvzgf3yw5nyw5iyw4=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "style=" border:0px; "/>

Source code Download: http://download.csdn.NET/detail/lxq_xsyu/7178511


HTML5 Mobile Development Road (--PHONEGAP) build Android development environment

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.