PhoneGap开发环境搭建
PhoneGap开发环境搭建
![](https://images.cnblogs.com/cnblogs_com/random/phonegap/AndroidSDKManager.jpg)
<html>
<head>
<title>PhoneGap</title>
<script type="text/javascript" charset="utf-8" src="phonegap-x.x.x.js"></script>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
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" />
android:configChanges="orientation|keyboardHidden
![](https://images.cnblogs.com/cnblogs_com/random/phonegap/manifest.jpg)
![](https://images.cnblogs.com/cnblogs_com/random/phonegap/2011-12-27_222917.jpg)
![](https://images.cnblogs.com/cnblogs_com/random/phonegap/2011-12-27_223635.jpg)
然后就可以试着运行一下,成功的话会出现Hello World的界面。
import com.phonegap.api.PluginResult;
import com.phonegap.api.PluginResult.Status;
PluginResult pr=null;
if(action.equals("method1")){
pr=new PluginResult(Status.IO_EXCEPTION,"method1");
}else if(action.equals("method2")){
pr=new PluginResult(Status.OK,"method2");
}
return pr;
}
PhoneGap.exec(successCallback, //成功后的回调方法
failureCallback, //失败后的回调方法
'PluginTest',//刚才配置的类名
'method1', //方法名称,就是之前提到的action参数
["/sdcard"]); //sdcard路径
function successCallback(data){
alert("data:"+data);
}
function failureCallback(data){
alert("error:"+data);
}
</script>
人品没问题的话,这样就能run起来了。。。。。。。