Launch Eclipse, then under the File menu select New > Android Project
In the root directory of the project, create two new directories:
/libs
/assets/www
Copy phonegap.js from your PhoneGap download earlier to /assets/www
Copy phonegap.jar from your PhoneGap download earlier to /libs
Copy xml folder from your PhoneGap download earlier to /res/xml (xml 폴더 만들어서 안에 넣으세요 )
Make a few adjustments too the project's main Java file found in the src folder in Eclipse: (view image below)
Change the class's extend from Activity to DroidGap
Replace the setContentView() line with super.loadUrl("file:///android_asset/www/index.html");
Add import com.phonegap.*;
Remove import android.app.Activity;
You might experience an error here, where Eclipse can't find phonegap-1.0.0.jar. In this case, right click on the /libs folder and go to Build Paths/ > Configure Build Paths. Then, in the Libraries tab, add phonegap-1.0.0.jar to the Project. If Eclipse is being temperamental, you might need to refresh (F5) the project once again.
Right click on AndroidManifest.xml and select Open With > Text Editor
Paste the following permissions under versionName: (view image below)
<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" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
Add android:configChanges="orientation|keyboardHidden" to the activity tag in AndroidManifest. (view image below)
Add a second activity under you appliction tag in AndroidManifest. (view image below)
<activity android:name="com.phonegap.DroidGap" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden"> <intent-filter> </intent-filter> </activity>
1. 설치
http://jquerymobile.com/download/
관련 파일을 다운로드한다.
www 폴더에 jquery.mobile-1.0.1폴더 복사, jquery.mobile-1.0.1.min.js 복사
2. 샘플 코드 작성하기
/assets/www/index.html 을 아래와 같이 작성한다.
<!DOCTYPE HTML>
<html>
<head>
<title>PhoneGap</title>
<link href=" jquery.mobile-1.0.1/ jquery.mobile-1.0.1.min.css" rel="stylesheet" type="text/css" />
<script src=" jquery.mobile-1.0.1.min.js"></script>
<script src=" jquery.mobile-1.0.1/ jquery.mobile-1.0.1.min.js"></script>
<script type="text/javascript" charset="utf-8" src="phonegap-1.1.0.js"></script>
</head>
<body>
<div data-role="page" id="home">
<div data-role="header">
<h1>jQueryMobile</h1>
</div>
<div data-role="">
<p>Hello World!!</p>
</div>
<div data-role="footer">
<p>Hello World for jQueryMobile</p>
</div>
</div>
</body>
</html>
3. 실행
기존 빌드된 클래스를 재빌드하기 위하여, Project > Clean... 을 실행한다.
그런 후 Run > Run As > Android Application 을 실행한다.