{"id":917,"date":"2012-06-26T16:05:21","date_gmt":"2012-06-26T07:05:21","guid":{"rendered":"http:\/\/brain.dailyon.net\/?p=917"},"modified":"2012-06-26T16:05:21","modified_gmt":"2012-06-26T07:05:21","slug":"phonegap-getting-started-with-android%ed%8f%b0%ea%b0%ad-%ec%95%88%eb%93%9c%eb%a1%9c%ec%9d%b4%eb%93%9c-%ec%85%8b%ed%8c%85","status":"publish","type":"post","link":"https:\/\/blog.goorigo.com\/?p=917","title":{"rendered":"PhoneGap &#8211; Getting Started with Android(\ud3f0\uac2d \uc548\ub4dc\ub85c\uc774\ub4dc \uc14b\ud305)"},"content":{"rendered":"<h1><a name=\"Getting%20Started%20with%20Android\"><\/a><\/h1>\n<h1>\ucd9c\ucc98 \ud83d\ude15<a href=\"http:\/\/docs.phonegap.com\/en\/1.8.1\/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android\">http:\/\/docs.phonegap.com\/en\/1.8.1\/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android<\/a><\/h1>\n<p>&nbsp;<\/p>\n<h1>Getting Started with Android7<\/h1>\n<p>This guide describes how to set up your development environment for Cordova and run a sample application. Note that Cordova used to be called PhoneGap, so some of the sites still use the old PhoneGap name.<\/p>\n<h2><a name=\"Getting%20Started%20with%20Android_1_requirements\"><\/a>1. Requirements<\/h2>\n<ul>\n<li>Eclipse 3.4+<\/li>\n<\/ul>\n<h2><a name=\"Getting%20Started%20with%20Android_2_install_sdk_cordova\"><\/a>2. Install SDK + Cordova<\/h2>\n<ul>\n<li>Download and install?<a href=\"http:\/\/www.eclipse.org\/downloads\/\">Eclipse Classic<\/a><\/li>\n<li>Download and install?<a href=\"http:\/\/developer.android.com\/sdk\/index.html\">Android SDK<\/a><\/li>\n<li>Download and install?<a href=\"http:\/\/developer.android.com\/sdk\/eclipse-adt.html#installing\">ADT Plugin<\/a><\/li>\n<li>Download the latest copy of?<a href=\"http:\/\/phonegap.com\/download\">Cordova<\/a>?and extract its contents. We will be working with the Android directory.<\/li>\n<\/ul>\n<h2><a name=\"Getting%20Started%20with%20Android_3_setup_new_project\"><\/a>3. Setup New Project<\/h2>\n<ul>\n<li>Launch Eclipse, and select menu item?<strong>New &gt; Android Project<\/strong>. Fill out the three panels of the?<strong>New Android Project<\/strong>wizard shown below.\n<p><img src=\"http:\/\/docs.phonegap.com\/en\/1.8.1\/img\/guide\/getting-started\/android\/AndroidFlow.png\" alt=\"\" \/><\/li>\n<li>In the root directory of your project, create two new directories:\n<ul>\n<li><strong>\/libs<\/strong><\/li>\n<li><strong>assets\/www<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>Copy?<strong>cordova-1.8.0.js<\/strong>?from your Cordova download earlier to?<strong>assets\/www<\/strong><\/li>\n<li>Copy?<strong>cordova-1.8.0.jar<\/strong>?from your Cordova download earlier to?<strong>\/libs<\/strong><\/li>\n<li>Copy?<strong>xml<\/strong>?folder from your Cordova download earlier to?<strong>\/res<\/strong><\/li>\n<li>Verify that?<strong>cordova-1.8.0.jar<\/strong>?is listed in the Build Path for your project. Right click on the \/libs folder and go to?<strong>Build Paths\/ &gt; Configure Build Path&#8230;<\/strong>. Then, in the Libraries tab, add?<strong>cordova-1.8.0.jar<\/strong>?to the project. If Eclipse is being temperamental, you might need to refresh (F5) the project once again.\n<p><img src=\"http:\/\/docs.phonegap.com\/en\/1.8.1\/img\/guide\/getting-started\/android\/buildPath.jpg\" alt=\"\" \/><\/li>\n<li>Edit your project&#8217;s main Java file found in the?<strong>src<\/strong>?folder in Eclipse:\n<ul>\n<li>Add?<strong>import org.apache.cordova.*;<\/strong><\/li>\n<li>Change the class&#8217;s extend from?<strong>Activity<\/strong>?to?<strong>DroidGap<\/strong><\/li>\n<li>Replace the?<strong>setContentView()<\/strong>?line with?<strong>super.loadUrl(&#8220;file:\/\/\/android_asset\/www\/index.html&#8221;);<\/strong><\/li>\n<\/ul>\n<p><img src=\"http:\/\/docs.phonegap.com\/en\/1.8.1\/img\/guide\/getting-started\/android\/javaSrc.jpg\" alt=\"\" \/><\/li>\n<li>Right click on AndroidManifest.xml and select?<strong>Open With &gt; XML Editor<\/strong><\/li>\n<li>Paste the following permissions between the?<strong>&lt;uses-sdk&#8230;\/&gt;<\/strong>?and?<strong>&lt;application&#8230;\/&gt;<\/strong>?tags.\n<p>&nbsp;<\/p>\n<pre><code>&lt;supports-screens \n? ? android:largeScreens=\"true\" \n? ? android:normalScreens=\"true\" \n? ? android:smallScreens=\"true\" \n? ? android:resizeable=\"true\" \n? ? android:anyDensity=\"true\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.VIBRATE\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.READ_PHONE_STATE\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.INTERNET\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.RECEIVE_SMS\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.RECORD_AUDIO\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.READ_CONTACTS\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.WRITE_CONTACTS\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" \/&gt; \n&lt;uses-permission android:name=\"android.permission.GET_ACCOUNTS\" \/&gt;\n&lt;uses-permission android:name=\"android.permission.BROADCAST_STICKY\" \/&gt;\n<\/code><\/pre>\n<\/li>\n<li>Support orientation changes by pasting the folowing inside the?<strong>&lt;activity&gt;<\/strong>?tag.\n<p>&nbsp;<\/p>\n<pre><code>android:configChanges=\"orientation|keyboardHidden|screenSize\"\n<\/code><\/pre>\n<\/li>\n<li>Your AndroidManifest.xml file should look like\n<p>&nbsp;<\/p>\n<p><img src=\"http:\/\/docs.phonegap.com\/en\/1.8.1\/img\/guide\/getting-started\/android\/manifest.jpg\" alt=\"\" \/><\/li>\n<\/ul>\n<h2><a name=\"Getting%20Started%20with%20Android_4_hello_world\"><\/a>4. Hello World<\/h2>\n<ul>\n<li>Create and open a new file named?<strong>index.html<\/strong>?in the?<strong>assets\/www<\/strong>?directory. Paste the following code:\n<pre><code>&lt;!DOCTYPE HTML&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;title&gt;Cordova&lt;\/title&gt;\n&lt;script type=\"text\/javascript\" charset=\"utf-8\" src=\"cordova-1.8.0.js\"&gt;&lt;\/script&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;h1&gt;Hello World&lt;\/h1&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h2><a name=\"Getting%20Started%20with%20Android_5a_deploy_to_simulator\"><\/a>5A. Deploy to Simulator<\/h2>\n<ul>\n<li>Right click the project and go to?<strong>Run As &gt; Android Application<\/strong><\/li>\n<li>Eclipse will ask you to select an appropriate AVD. If there isn&#8217;t one, then you&#8217;ll need to create it.<\/li>\n<\/ul>\n<h2><a name=\"Getting%20Started%20with%20Android_5b_deploy_to_device\"><\/a>5B. Deploy to Device<\/h2>\n<ul>\n<li>Make sure USB debugging is enabled on your device and plug it into your system. (<strong>Settings &gt; Applications &gt; Development<\/strong>)<\/li>\n<li>Right click the project and go to?<strong>Run As &gt; Android Application<\/strong><\/li>\n<\/ul>\n<h2><a name=\"Getting%20Started%20with%20Android_done\"><\/a>Done!<\/h2>\n","protected":false},"excerpt":{"rendered":"<p>\ucd9c\ucc98 \ud83d\ude15http:\/\/docs.phonegap.com\/en\/1.8.1\/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android &nbsp; Getting Started with Android7 This guide describes how to set up your development environment for Cordova and run a sample application. Note that Cordova used to be&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[54],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/posts\/917"}],"collection":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=917"}],"version-history":[{"count":0,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=\/wp\/v2\/posts\/917\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.goorigo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}