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;"/>
Package com.example.hellomobile;
Import Android.os.Bundle;
Import android.app.Activity;
Import Android.view.Menu;
Import org.apache.cordova.*;
Public class Mainactivity extends Droidgap {
@Override
public void OnCreate (Bundle savedinstancestate) {
super.oncreate (savedinstancestate);
//setcontentview (R.layout.activity_main);
Super.setintegerproperty ("SplashScreen", R.drawable.splash);
Super.loadurl ("file:///android_asset/www/index.html", 2000);
}
}
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;"/>
<uses-permission android:name="Android.permission.CAMERA" />
<uses-permission android:name="Android.permission.VIBRATE" />
<uses-permission android:name="Android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="Android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="Android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="Android.permission.INTERNET" />
<uses-permission android:name="Android.permission.RECEIVE_SMS" />
<uses-permission android:name="Android.permission.RECORD_AUDIO" />
<uses-permission android:name="Android.permission.RECORD_VIDEO" />
<uses-permission android:name="Android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="Android.permission.READ_CONTACTS" />
<uses-permission android:name="Android.permission.WRITE_CONTACTS" />
<uses-permission android:name="Android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="Android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="Android.permission.GET_ACCOUNTS" />
<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