{"id":663,"date":"2015-06-17T13:39:42","date_gmt":"2015-06-17T20:39:42","guid":{"rendered":"http:\/\/internetofhomethings.com\/homethings\/?p=663"},"modified":"2015-06-20T06:30:59","modified_gmt":"2015-06-20T13:30:59","slug":"native-android-app-development-using-only-html-javascript-css","status":"publish","type":"post","link":"https:\/\/internetofhomethings.com\/homethings\/?p=663","title":{"rendered":"Native Android App Development Using Only HTML-Javascript-CSS"},"content":{"rendered":"<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/06\/cordova.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-667\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/06\/cordova.jpg\" alt=\"cordova\" width=\"725\" height=\"548\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/06\/cordova.jpg 725w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/06\/cordova-300x227.jpg 300w\" sizes=\"auto, (max-width: 725px) 100vw, 725px\" \/><\/a>Here&#8217;s a handy gem for your bag of tricks. Did you know that a native Android App can be developed using only the web familiar html, javascript and css? Without the need to dig deep into the bowels of the OS.<\/p>\n<p>Yep, it is definitely possible\u00a0&#8211; all\u00a0while still offering control of all your device&#8217;s interfaces such as cameras, bluetooth, wifi&#8230;you name it. You see, the hardware dependent components are supported with an Apache developed\u00a0framework called Cordova. And while this article focuses on the Android platform, the same App can easily be ported to ios or Amazon Fire, with little or no change. Making it possible to develop your App once for distribution across several different device types.<\/p>\n<p>Here is how to setup the development environment and install an application on an Android device.<\/p>\n<hr \/>\n<h3 style=\"text-align: center;\"><b>Setting Up The\u00a0Environment<\/b><\/h3>\n<p>The trick is using Cordova to provide a platform for building native applications using only HTML. CSS, and Javascript.<\/p>\n<p>What is Cordova?<\/p>\n<p>This is a group of \u00a0APIs supporting the development of native Apps without using the language of the device. These APIs provide access to the device&#8217;s hardware sensors. And with a few simple steps, you are up and running, developing your unique application.<\/p>\n<p>Step 1:<\/p>\n<p><strong>Install node.js from nodejs.org<\/strong><\/p>\n<p>This will allow you to run \u201cnode\u201d and \u201cnpm\u201d from a command line window.<\/p>\n<p>Step 2:<\/p>\n<p><strong>Install a git client from <a href=\"http:\/\/git-scm.com\/\">http:\/\/git-scm.com\/<\/a>.<\/strong><\/p>\n<p>This will allow you to invoke \u201cgit\u201d from a command line.<\/p>\n<p>Step 3:<\/p>\n<p><strong>Install the Cordova module<\/strong> using npm by entering the following at the command line:<\/p>\n<p>npm install -g cordova<\/p>\n<p>Step 4:<\/p>\n<p><a href=\"http:\/\/developer.android.com\/\">S<\/a>etup the Eclipse for Android App Development Environment by following the following instructable:<\/p>\n<p><a href=\"http:\/\/www.instructables.com\/id\/How-To-Setup-Eclipse-for-Android-App-Development\/?ALLSTEPS\">http:\/\/www.instructables.com\/id\/How-To-Setup-Eclipse-for-Android-App-Development\/?ALLSTEPS<\/a><\/p>\n<hr \/>\n<h3 style=\"text-align: center;\"><b>Creating A New Application<\/b><\/h3>\n<p>Step 1:<\/p>\n<p><strong>Open a cmd windows<\/strong>.<\/p>\n<p>Step 2:<\/p>\n<p><strong> Change directory<\/strong> to the base directory for your workspaces (your choice).<\/p>\n<p>Cd c:\\myworkspace<\/p>\n<p>Step 3:<\/p>\n<p><strong>Create new folder<\/strong> with app name (no spaces):<\/p>\n<p>mkdir mynewapp<\/p>\n<p>cd mynewapp<\/p>\n<p>Step 4:<\/p>\n<p><strong>Create app file structure<\/strong>:<\/p>\n<p>cordova create appfiles com.author.mynewapp MyAppTitle<\/p>\n<p>Where<\/p>\n<ul>\n<li>&#8220;appfiles&#8221; is the folder to create the app file structure<\/li>\n<li>&#8220;com&#8221; is the convention used to start the app filename<\/li>\n<li>&#8220;author&#8221; is the developer or company name or initials<\/li>\n<li>&#8220;mynewapp&#8221; is the bame of the app<\/li>\n<li>&#8220;MyAppTitle&#8221; is the title\u00a0of the app<\/li>\n<\/ul>\n<p>Step 5:<\/p>\n<p><strong>Add platform<\/strong> (android or ios)<\/p>\n<p>cd appfiles<\/p>\n<p>cordova platform add android<\/p>\n<p>Step 6:<\/p>\n<p><strong>Add plugins<\/strong> as needed (basic required plugins;device,console,file\u00a0shown here)<\/p>\n<p>Get plugin names from plugins.cordova.io\/#\/ Then enter the following for each plugin to be added:<\/p>\n<p>cordova plugins add org.apache.cordova.device<\/p>\n<p>cordova plugins add org.apache.cordova.console<\/p>\n<p>cordova plugins add org.apache.cordova.file<\/p>\n<p>In the future, plugins will be delivered using npm. See the instruction at\u00a0plugins.cordova.io\/#\/ for more information regarding npm plugin delivery.<\/p>\n<hr \/>\n<h3 style=\"text-align: center;\"><b>Building the Application<\/b><\/h3>\n<p>Step 1:<\/p>\n<p><strong> Open Eclipse<\/strong><\/p>\n<p>Step 2:<\/p>\n<p><strong>Install<\/strong>\u00a0your <strong>USB cable<\/strong> from the PC running eclipse to\u00a0the Android device.<\/p>\n<p>Step 3:<\/p>\n<p><strong> Select Import from the File menu<\/strong>.<\/p>\n<p>Step 4:<\/p>\n<p><strong> Select the base folder<\/strong> created for the newly created project.<\/p>\n<p>Step 5:<\/p>\n<p><strong> First Select \u201cClean\u201d<\/strong> from the Project Menu.<\/p>\n<p>Step 6:<\/p>\n<p>Then <strong>Click on the \u201cRun\u201d icon<\/strong> to build and launch the new app on your device<\/p>\n<hr \/>\n<h3 style=\"text-align: center;\"><b>Editing The\u00a0Application<\/b><\/h3>\n<p><span style=\"line-height: 1.5;\">The App starts with the launching of the index.html file located at:<\/span><\/p>\n<p>&lt;your base app workspace folder&gt;\\iotmobile\\appfiles\\platforms\\android\\assets\\www<\/p>\n<p>this file should be edited to change the functionality of the App. Javascript\/Jquery and css files can similarly be customized. They are located at:<\/p>\n<p>&lt;your base app workspace folder&gt;\\iotmobile\\appfiles\\platforms\\android\\assets\\www\\js<\/p>\n<hr \/>\n<h3 style=\"text-align: center;\"><b>Conclusion<\/b><\/h3>\n<p>There you have it!<\/p>\n<p>A quick reference to setting up the Android Development Environment, creating a blank project, building the App and finally loading running it on your device. Now it&#8217;s\u00a0your turn. What will you create?<\/p>\n<p>I hope you find this information useful&#8230;<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/06\/droid.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-672\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/06\/droid.jpg\" alt=\"droid\" width=\"252\" height=\"448\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/06\/droid.jpg 252w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/06\/droid-169x300.jpg 169w\" sizes=\"auto, (max-width: 252px) 100vw, 252px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a handy gem for your bag of tricks. Did you know that a native Android App can be developed using only the web familiar html, javascript and css? Without &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,3],"tags":[45,42,44,43],"class_list":["post-663","post","type-post","status-publish","format-standard","hentry","category-alltheposts","category-web-coding-tips","tag-android","tag-android-app","tag-android-app-development","tag-mobile-app-from-html"],"_links":{"self":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=663"}],"version-history":[{"count":12,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/663\/revisions"}],"predecessor-version":[{"id":677,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/663\/revisions\/677"}],"wp:attachment":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}