First, about PhoneGap
PhoneGap is an open-source development framework designed to enable developers to develop cross-platform mobile applications using Web APIs such as HTML, Javascript, and CSS.
Second, PhoneGap in the Android environment to build
1. Make sure the Android development environment is installed on your computer, and download the corresponding version of the ZIP package on the PHONEGAP official website (www.phoneGap.com).
Click here to download PhoneGap1.4.0
2. Create an Android project.
3. Unzip the ZIP package that you just downloaded, add the. jar file in the/lib/android to the Libs folder in the project engineering, and then perform the action to add the. jar package. :
Add the completed Project catalog:
4. Create a new folder under the Project Directory Assets folder, name is WWW, add the. js file from the/lib/android in the downloaded zip package.
5. Add the appropriate permissions in the Androidmainfest.xml file:
<supports-screens
Android:largescreens= "true"
Android:normalscreens= "true"
Android:smallscreens= "true"
Android:xlargescreens= "true"
Android:resizeable= "true"
Android:anydensity= "true"
/>
<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"/>
<uses-feature android:name= "Android.hardware.camera"/>
<uses-feature android:name= "Android.hardware.camera.autofocus"/>
6. Create a file in the/assets/www directory index.html
7. In the project res directory download, create a new folder named XML, the downloaded Zip package/lib/android/xml in the Phonegap.xml and plugins.xml add in.
8. Mainactivity.java to inherit droidgap and modify protected void OnCreate (bundle savedinstancestate) to public void onCreate (bundle Savedinstancestate). and load the index.html through the code.
9. Publish the program to the emulator.
Third, the demo project download
Click I download demo
Basic use of PhoneGap in Android development