android 引入phonegap
步骤:
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.显示结果:
附件地址:https://files.cnblogs.com/files/laopo/phonegag%E6%8F%92%E4%BB%B6.rar
http://tools.android-studio.org/index.php/proxy android 更新
转载 请注明原文地址并标明转载:http://www.cnblogs.com/laopo
商业用途请与我联系:lcfhn168@163.com