标签:
步骤:
1.复制cordova-2.9.0.jar 到lib文件下
2.在assets文件下创建www文件夹及其cordova.js 、jquery.js、jquery.mobile-1.3.2.css,jquery.mobile-1.3.2.js、index.html
3.在src中MainActivity.Java
1)引入import org.apache.cordova.*;注释//import android.app.Activity;
2)用DroidGap替 换Activity
3)用public 替换Protect
4)用super.loadUrl("file:///android_asset/www/index.html"); 替换//setContentView(R.layout.activity_main); 不过也要创建index.html文件
4.在res文件夹中引入XML文件夹及config.xml文件
5.在AndroidManifest.xml 引入下面代码 <uses-sdk/> 代码<application/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="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.READ_PHONE_STATE" /> <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.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" />
6.显示结果:
附件地址:http://files.cnblogs.com/files/laopo/phonegag%E6%8F%92%E4%BB%B6.rar
标签:
原文地址:http://www.cnblogs.com/laopo/p/4888278.html