A. Environment Construction
1. Build a development Android environment, no longer described here, you can use the ADT integration environment, you can also use Eclipse + Android SDK + ADT Plugin.
ADT Integration Environment: http://developer.android.com/sdk/index.html
2. Configure PhoneGap
phonegap:http://phonegap.com/install/
This document is not suitable for versions above phonegap-2.9.0, and is suitable for phonegap-2.9.0 of the following versions, as some of the files required below are not found in phonegap-2.9.1.
2.1 Create a new Android project.
2.2 Copy the jar file from the Android directory under the PhoneGap directory to the project's Libs directory.
2.3 Copy the XML directory to the project's res directory.
2.4 In the assets directory, set up a WWW directory, the following HTML content. To test, copy the contents of the PhoneGap example.
2.5 Modify the activity code of the newly created Android project.
Modify the code to the following code:
<span style= "Font-family:times New Roman;" >importandroid.os.Bundle;importorg.apache.cordova.*; Publicclass mainactivity extends droidgap{ @Override public void OnCreate (bundlesavedinstancestate) { super.oncreate (savedinstancestate); Set by <contentsrc= ' index.html '/> in config .//super.loadurl (Config.getstarturl ()); Super.loadurl ("file:///android_asset/www/index.html") }}</span>
Note the point:
Mainactivity inherits Droidgap, then imports the Droidgap class, which is the import org.apache.cordova.*; The HTML file under the Assets/www directory is then called in OnCreate ().
2.6 Modifying the contents of Androidmanifest.xml for Android projects
Modify the following:
<span style= "Font-family:times New Roman;" ><manifestxmlns:android= "Http://schemas.android.com/apk/res/android" package= "Com.lilu.helloworld" Android : Hardwareaccelerated= "True" android:versioncode= "1" android:versionname= "1.0" android:windowsoftinputmode= "Adjust Pan "> <supports-screens android:anydensity=" true "android:largescreens=" true "Android:norm Alscreens= "true" android:resizeable= "true" android:smallscreens= "true" android:xlargescreens= "true"/& Gt <uses-permissionandroid:name= "Android.permission.CAMERA"/> <uses-permissionandroid:name= " Android.permission.VIBRATE "/> <uses-permissionandroid:name=" Android.permission.ACCESS_COARSE_LOCATION "/ > <uses-permissionandroid:name= "Android.permission.ACCESS_FINE_LOCATION"/> <uses-permissionandroid: Name= "Android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/> <uses-permissionandroid:name= " Android.permission.INTERNET "/> <uses-permissionandroid:name= "Android.permission.RECEIVE_SMS"/> <uses-permissionandroid:name= " Android.permission.RECORD_AUDIO "/> <uses-permissionandroid:name=" Android.permission.RECORD_VIDEO "/> <uses-permissionandroid:name= "Android.permission.MODIFY_AUDIO_SETTINGS"/> <uses-permissionandroid:name = "Android.permission.READ_CONTACTS"/> <uses-permissionandroid:name= "Android.permission.WRITE_CONTACTS"/ > <uses-permissionandroid:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permissionandroid : Name= "Android.permission.ACCESS_NETWORK_STATE"/> <uses-permissionandroid:name= "android.permission.GET_ ACCOUNTS "/> <uses-permission android:name=" Android.permission.BROADCAST_STICKY "/> <application Android:debuggable= "true" android:hardwareaccelerated= "true" android:icon= "@drawable/ic_launcher" Androi D:label= "@string/app_name" > <activity andRoid:name= "com.lilu.helloworld.MainActivity" android:configchanges= "Orientation|keyboardhidden|keyboard|screens Ize|locale "android:label=" @string/app_name "Android:theme=" @android: Style/theme.black.notitlebar " ; <intent-filter> <actionandroid:name= "Android.intent.action.MAIN"/> <categor Yandroid:name= "Android.intent.category.LAUNCHER"/> </intent-filter> </activity> </ application> <uses-sdk android:minsdkversion= "7" android:targetsdkversion= "/> </manifest&" Gt;</span>
The main is to add some application permissions, note to change the package under the <manifest> tag to its own application's name, change the activity name to its own custom activity class.
This completes the configuration PhoneGap, and if you run the Android program successfully, you can see the data in the HTML page.
Then just write the HTML page you need.
Two Reference URL
1. http://www.cnblogs.com/kingofpop/articles/3249845.html
2. http://www.cnblogs.com/Random/archive/2011/12/28/2305398.html
ADT Integrated Environment +phonegap 2.9.0 build HTML5 development app Environment