{"id":3412,"date":"2018-04-07T21:30:01","date_gmt":"2018-04-07T16:00:01","guid":{"rendered":"https:\/\/code4developers.com\/?p=3412"},"modified":"2018-04-07T21:58:18","modified_gmt":"2018-04-07T16:28:18","slug":"capacitor-new-native-bridge-web-apps","status":"publish","type":"post","link":"https:\/\/code4developers.com\/capacitor-new-native-bridge-web-apps\/","title":{"rendered":"Capacitor &#8211; A New Native Bridge for Web Apps"},"content":{"rendered":"<p>A short while ago, the Ionic team announced that they were working on a project called \u201cAvocado\u201d which later took on its official moniker of <a href=\"https:\/\/capacitor.ionicframework.com\/\" target=\"_blank\" rel=\"noopener\">Capacitor<\/a>. In this article, I want to introduce you to Capacitor and what it will do.<\/p>\n<p><!--more--><\/p>\n<p>I will get into the specifics soon (and we will build an example as well), but for now, it is easiest to think of <b>Capacitor<\/b> as the Ionic team\u2019s own version of <a href=\"https:\/\/cordova.apache.org\/\" target=\"_blank\" rel=\"noopener\">Cordova<\/a>.<\/p>\n<p>Capacitor is not only for Ionic applications. All you need to do to make Capacitor work with an existing project is provide it with the path to the web code that you want to be bundled into the native application, so it could work with just about anything. The philosophy of Capacitor seems to be to easily integrate with whatever build setup you already have, rather than having to integrate your existing projects into Capacitor.<\/p>\n<p>Capacitor is still running somewhat in <i>stealth mode<\/i> before the official public alpha release, but the <a href=\"https:\/\/capacitor.ionicframework.com\/docs\/\" target=\"_blank\" rel=\"noopener\">documentation<\/a> is available online now so you can start to play around with it if you like. However, to make it perfectly clear, I\u2019d like to offer you the following disclaimer\u2026<\/p>\n<p><b>IMPORTANT:<\/b> Capacitor is <b>not currently ready for production use<\/b>. It is not even technically in public alpha yet. It should only be used at this stage for learning, testing, or just playing around. The Ionic team is currently looking for people to help test Capacitor inside of \u201creal\u201d projects, so if you would like to test it out in your project you can report any issues <a href=\"https:\/\/github.com\/ionic-team\/capacitor\/issues\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p>This tutorial is only intended to help introduce Capacitor and get people more comfortable with the concept. Keep in mind that anything you read in this article may change at some point in the future.<\/p>\n<h2 id=\"what-is-capacitor\">What is Capacitor?<\/h2>\n<p>If you signed up for <a href=\"https:\/\/capacitor.ionicframework.com\/\" target=\"_blank\" rel=\"noopener\">updates from Capacitor<\/a> then you may have received an email from Max Lynch (Co-founder, Ionic) detailing what it is all about. For any official word on what Capacitor\u2019s goals are, you should listen to what Max and the Ionic team have to say \u2013 I expect they will release a blog post when the public alpha is officially launched. The following will be my take on the role and purpose of Capacitor.<\/p>\n<p>As I mentioned before, you can consider Capacitor to be the Ionic team\u2019s own version of Cordova. If you were to use Capacitor, you would be using it instead of Cordova to add native functionality to your web-based mobile applications. Like Cordova, Capacitor will be the bridge between the browser and the device. I think that the <a href=\"https:\/\/capacitor.ionicframework.com\/\" target=\"_blank\" rel=\"noopener\">Capacitor website<\/a> describes its goals quite succinctly: <b>Native Progressive Web Apps<\/b>. Capacitor wants to be a runtime layer that allows you to build an application and have it run anywhere (even if you are integrating native code).<\/p>\n<p>The creation of Capacitor does not mean that anything is happening to Cordova. Cordova is a project run by the <b>Apache Software Foundation<\/b> \u2013 it is its own entity and will continue to exist and function as it always has.<\/p>\n<p>Of course, the Ionic team is not designing their own version of Cordova just for the thrill of it. Capacitor has many worthwhile goals, and will eventually become the default over Cordova for Ionic applications. However, the Ionic team has stated that they will continue to support Cordova. One thing I think is worthwhile pointing out is this statement from Max in one of the update emails for Capacitor:<\/p>\n<blockquote><p>Our hesitation to jump into this project was driven primarily by not wanting to seem like we were abandoning or throwing out Cordova and Cordova\u2019s technology approach. Rather, we want to build on it and improve it. We hope that comes across.<br \/>\n<span class=\"su-quote-cite\">Max Lynch<\/span><\/p><\/blockquote>\n<p>The Ionic team could have instead decided to build the features they wanted into Cordova, rather than creating a new native bridge, but ultimately decided that they would need full control of the project to best execute their vision. Making large sweeping changes to a well established and mature framework is not an easy task.<\/p>\n<p>I can see how some people may see this move as a snub to Cordova, especially to those who have put a lot of effort into that ecosystem. Hopefully, this move will not be seen as a competitive or vindictive one, but rather a move that the Ionic team felt necessary to make real strides towards the goal of <b>one codebase, all platforms<\/b>.<\/p>\n<h2 id=\"what-will-capacitor-do-differently-to-cordova\">What will Capacitor do differently to Cordova?<\/h2>\n<p>The biggest source of friction when developing cross-platform applications using web technology is often the native bridge between the browser and the device, which is a role that Cordova has typically filled. This is the crux of the whole \u201chybrid\u201d approach to building mobile applications, so it makes sense that this is where the friction is often found. It also makes sense that this is then an area with huge potential for improvement.<\/p>\n<p>So, what does the Ionic team plan on doing to improve this? Here are a few things that stand out to me in particular:<\/p>\n<p><b>PWA Compatibility<\/b>. There has been a huge movement for Progressive Web Applications recently. They are starting to receive more support from browsers, and more tools are starting to pop up to help people build PWAs. One cool thing about a PWA is that it can also easily be bundled as a native application and access native functionality (using Cordova\/Capacitor). Native code will not work when running as a PWA through the browser, though. This can make maintaining a single codebase for a project that will be distributed as a native application and as a PWA (and perhaps even as a desktop application as well) difficult. With Capacitor as the runtime layer, it will be able to gracefully handle any error that arises from attempting to access native functionality in an environment that does not have it.<\/p>\n<p><b>Ease of integrating native controls<\/b>. Capacitor is aiming to make it easier to include native user interface controls wherever desired. For example, if you wanted to use a native menu rather than using the browser to create that interface.<\/p>\n<p><b>Native functionality available immediately<\/b>. When using Cordova, you need to wait until the device is ready before making calls to native functionality (e.g. by using <code>platform.ready()<\/code>). Capacitor will export JavaScript on app boot so that this is no longer required.<\/p>\n<p><b>Plugin support<\/b>. All native functionality is accessed through a plugin. If you want to use the Camera, then you use the camera plugin. If there isn\u2019t a plugin available to do what you want, or there is but it is not being maintained, you are somewhat out of luck unless you know how to build the plugin yourself. Capacitor is aiming to make the process of creating and maintaining plugins easier.<\/p>\n<p><b>Redesigned plugins<\/b>. Capacitor will include a core set of plugins (Camera, File API, Geolocation, etc.) that will be maintained by the Ionic team. They plan on redesigning these plugins to solve some common issues (like the difficulty of using the File API, and the way Android Geolocation works).<\/p>\n<p><b>Localised installation<\/b>. Capacitor will be installed locally in projects, meaning that it will be easier to maintain multiple different versions between multiple projects.<\/p>\n<p>Although Capacitor operates quite differently to Cordova, the Ionic team are still aiming for backward compatibility with as many Cordova plugins as possible.<\/p>\n<h2 id=\"adding-capacitor-to-an-ionic-application\">Adding Capacitor to an Ionic Application<\/h2>\n<p>Now that we\u2019ve discussed what Capacitor is, let\u2019s build something! You can find a Capacitor start project <a href=\"https:\/\/github.com\/ionic-team\/capacitor-starter\" target=\"_blank\" rel=\"noopener\">here<\/a>. You can clone this and set up a Capacitor project that way, however, we are going to be adding Capacitor to an existing Ionic project (I will assume you are already familiar with creating Ionic projects). We will just generate a blank Ionic project, and add a simple call to the Camera plugin.<\/p>\n<p>Capacitor relies on using the <code>npx<\/code> command, which is only available in version <code>8.3.0<\/code> or higher of Node. You likely already have Node installed, so the easiest way to switch between Node versions is to install :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">npm install -g n<\/pre>\n<p>You can then switch to any Node version you like (you may want to make note of your existing Node environment in case you have projects that rely on it). To switch to version <code>8.3.0<\/code> you would just run:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">n 8.3.0<\/pre>\n<p>If you plan on building for iOS, you will also need Cocoapods installed (a dependency manager for iOS projects). If you do not already have it installed, you can just run the following command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">sudo gem install cocoapods<\/pre>\n<h3 id=\"1-generate-a-new-ionic-application\">1. Generate a New Ionic Application<\/h3>\n<p>We are just going to use a blank Ionic project and add Capacitor to it:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">ionic start capacitor-test blank<\/pre>\n<p>When asked, do not integrate Cordova with the project. Once it has finished installing, make it your working directory:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">cd capacitor-test<\/pre>\n<h3 id=\"2-add-capacitor-to-the-project\">2. Add Capacitor to the Project<\/h3>\n<p>Eventually, Capacitor will be integrated with the Ionic CLI by default, so you wouldn\u2019t have to bother with these set up steps. For now, it is still easy enough to set up Capacitor. First, we will need to add a file called <b>capacitor.config.json<\/b> to the root folder of the project:<\/p>\n<p><b>capacitor.config.json<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">{\r\n  \"bundledWebRuntime\": true,\r\n  \"webDir\": \"www\"\r\n}<\/pre>\n<p>It is important that you add the <code>webDir<\/code> property because this is where Capacitor will look for the web code to bundle into the application \u2013 by default, it is set to \u201cpublic\u201d. You will also need to add the following dependencies to <b>package.json<\/b> (do not remove the existing dependencies):<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">\"dependencies\": {\r\n  \/\/...snip\r\n  \"@capacitor\/cli\": \"latest\",\r\n  \"@capacitor\/core\": \"latest\"\r\n}<\/pre>\n<p>and you will need to add the following under <code>\"scripts\"<\/code> (again, don\u2019t remove the other entries):<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">\"scripts\": {\r\n  \/\/...snip\r\n  \"capacitor\": \"capacitor\"\r\n},<\/pre>\n<p>Once you have made these changes, you will need to install the new dependencies by running:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">npm install<\/pre>\n<p>To add native platforms that you are targeting you can run the following command for iOS:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">npx capacitor add ios<\/pre>\n<p>or for Android:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">npx capacitor add android<\/pre>\n<p>You will now see <b>android<\/b> and <b>ios<\/b> folders in the root folder of your project. This is all that is required to get Capacitor set up in your application. This does assume that already have the appropriate building environment for iOS\/Android set up on your machine (i.e. you have previously been able to successfully create Cordova builds). If you do not have XCode\/Android Studio set up on your machine, you can follow <a href=\"https:\/\/ionicframework.com\/docs\/intro\/deploying\/\" target=\"_blank\" rel=\"noopener\">this guide<\/a> by the Ionic team.<\/p>\n<h3 id=\"3-use-the-camera-plugin\">3. Use the Camera Plugin<\/h3>\n<p>Now we are just going to take a look at a very basic example of integrating the Camera plugin. You can find documentation for the Camera plugin and other plugins <a href=\"https:\/\/capacitor.ionicframework.com\/docs\/\" target=\"_blank\" rel=\"noopener\">here<\/a>. To access a plugin from Capacitor, all we need to do is import the <code>Plugins<\/code> from <code>@capacitor\/core<\/code>:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">import { Plugins } from '@capacitor\/core';<\/pre>\n<p>and then we can access the plugin that we are interested in. If we wanted to set up a function that allowed a user to grab a photo from the camera or the user\u2019s photo library, we might do this:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"atomic\">import { Component } from '@angular\/core';\r\nimport { NavController } from 'ionic-angular';\r\nimport { Plugins } from '@capacitor\/core';\r\n \r\n@Component({\r\n  selector: 'page-home',\r\n  templateUrl: 'home.html'\r\n})\r\nexport class HomePage {\r\n \r\n    constructor(public navCtrl: NavController) {\r\n \r\n    }\r\n \r\n    grabPhoto() {\r\n        const { Camera } = Plugins;\r\n \r\n        Camera.getPhoto({\r\n            quality: 100,\r\n            resultType: 'base64'\r\n        }).then((result) =&gt; {\r\n            console.log(result);\r\n        }).catch((err) =&gt; {\r\n            console.log(err);\r\n            console.log('Sorry pal, not going to happen');\r\n        });\r\n    }\r\n }<\/pre>\n<p>This would grab the photo and return it to us in <code>base64<\/code> format. It is important that we include the <code>catch<\/code> statement here because if we don\u2019t and we attempt to run this application as a PWA we would get the following error:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">ERROR Error: Uncaught (in promise): Plugin does not have web implementation.<\/pre>\n<p>By adding the <code>catch<\/code> statement, we can gracefully handle this error without breaking the application:<\/p>\n<p><img  loading=\"lazy\"  decoding=\"async\"  data-attachment-id=\"3414\"  data-permalink=\"https:\/\/code4developers.com\/capacitor-new-native-bridge-web-apps\/screenshot-2018-02-07-12-11-05\/\"  data-orig-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?fit=995%2C86&amp;ssl=1\"  data-orig-size=\"995,86\"  data-comments-opened=\"1\"  data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\"  data-image-title=\"Catch\"  data-image-description=\"\"  data-image-caption=\"\"  data-medium-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?fit=800%2C69&amp;ssl=1\"  data-large-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?fit=700%2C61&amp;ssl=1\"  class=\"wp-image-3414 aligncenter pk-lazyload\"  src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAP+KeNJXAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=\"  alt=\"Catch\"  width=\"738\"  height=\"64\"  data-pk-sizes=\"auto\"  data-ls-sizes=\"auto, (max-width: 738px) 100vw, 738px\"  data-pk-src=\"https:\/\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05-300x26.png\"  data-pk-srcset=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=300%2C26&amp;ssl=1 300w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=800%2C69&amp;ssl=1 800w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=700%2C61&amp;ssl=1 700w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=120%2C10&amp;ssl=1 120w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=90%2C8&amp;ssl=1 90w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=320%2C28&amp;ssl=1 320w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=560%2C48&amp;ssl=1 560w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=240%2C21&amp;ssl=1 240w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=180%2C16&amp;ssl=1 180w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=640%2C55&amp;ssl=1 640w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?resize=768%2C66&amp;ssl=1 768w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Screenshot-2018-02-07-12.11.05.png?w=995&amp;ssl=1 995w\" ><\/p>\n<p>This example will now work seamlessly across multiple platforms. The concept of having plugins not break the web-based implementation of the application is not new, this was something we could do with Ionic Native\/Cordova as well, this is just one of the things that the Ionic team wants to make easy with Capacitor.<\/p>\n<p><b>NOTE:<\/b> As Max has pointed out in the comments below, the Ionic team do intend to build out web implementations of these plugins. So, in the above example you <i>could<\/i> actually use this plugin and have it provide you with a nice camera interface even when running as a PWA.<\/p>\n<h3 id=\"4-build-the-application\">4. Build the Application<\/h3>\n<p>We have an application that uses Capacitor, and we have an example implementation of using the Camera plugin, now we just need to deploy it to a device. As I mentioned before, Capacitor works in with whatever your existing environment is. So, in order to produce a production build, you just do whatever it is you normally would.<\/p>\n<p>In the case of Ionic, we can create a production build by running the following command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">npm run ionic:build --prod<\/pre>\n<p>This will create a production version of our code in the <code>www<\/code> directory, which is the directory we told Capacitor to get the web code from earlier. Now you just need to copy this web code into the iOS and Android projects that you created earlier. For iOS you can run:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">npx capacitor copy ios<\/pre>\n<p>and for Android you can run:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">npx capcitor copy android<\/pre>\n<p>Then to build the applications, you once again just build it the way you would with a normal iOS\/Android project. If you were to run the following command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"atomic\">npx capcitor open<\/pre>\n<p>and choose <code>ios<\/code>, the application would be launched inside of XCode. From there, you can just hit the play button in the top left to create a build of your application and run it.<\/p>\n<h2 id=\"summary\">Summary<\/h2>\n<p>Whilst there already is a lot of codeshare with the way we build Ionic applications today, with the introduction of Capacitor Ionic really seem to be making the <i>one codebase, all platforms<\/i> dream a literal reality. This project should greatly simplify the process of deploying a single codebase as Desktop\/Web\/iOS\/Android application.<\/p>\n<p>As you can probably tell, this is not some big scary change that is going to completely change the way you build your applications. Once Capacitor is production ready, if you choose to use it, most people will likely be looking at some simple syntax changes.<\/p>\n<div class=\"crp_related\">\n<h3 id=\"what-to-read-next\">What to read next&#8230;<\/h3>\n<ul>\n<li>\n<h4 id=\"ionic-project-structure-and-installation\"><a href=\"https:\/\/code4developers.com\/ionic-project-structure-installation\/\">Ionic Project Structure and Installation<\/a><\/h4>\n<\/li>\n<li>\n<h4 id=\"javascript-running-on-a-wearable-yes-and-its-native-and-angular\"><a href=\"https:\/\/code4developers.com\/nativescript-and-angular-with-android-wear\/\">JavaScript Running On A Wearable? Yes, And Its Native and Angular.<\/a><\/h4>\n<\/li>\n<li>\n<h4 id=\"why-progressive-web-apps\"><a href=\"https:\/\/code4developers.com\/why-progressive-web-apps\/\">Why Progressive Web Apps<\/a><\/h4>\n<\/li>\n<li>\n<h4 id=\"webpack-introduction-without-any-code\"><a href=\"https:\/\/code4developers.com\/webpack-introduction-without-code\/\">Webpack: introduction without any code.<\/a><\/h4>\n<\/li>\n<li>\n<h4 id=\"javascript-why-does-3-true-4-and-7-other-tricky-equations\"><a href=\"https:\/\/code4developers.com\/javascript-3-true-4-7-tricky-equations\/\">JavaScript: Why does 3 + true = 4? (and 7 other tricky equations)<\/a><\/h4>\n<\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A short while ago, the Ionic team announced that they were working on a project called \u201cAvocado\u201d which later took on its official moniker of Capacitor. In this article, I&hellip;<\/p>\n","protected":false},"author":7,"featured_media":3415,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[140],"tags":[147,150,144,143,141,146,145,149,80,21,148],"powerkit_post_featured":[],"class_list":{"0":"post-3412","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ionic","8":"tag-android","9":"tag-avocado","10":"tag-capacitor","11":"tag-cordova","12":"tag-ionic","13":"tag-ios","14":"tag-native","15":"tag-native-progressive-web-apps","16":"tag-node","17":"tag-pwa","18":"tag-xcode"},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/Capacitor.png?fit=225%2C225&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8NAi4-T2","jetpack-related-posts":[{"id":3457,"url":"https:\/\/code4developers.com\/native-html5-games-with-phaser-and-capacitor\/","url_meta":{"origin":3412,"position":0},"title":"Native HTML5 Games with Phaser and Capacitor","author":"Arif Khoja","date":"April 17, 2018","format":false,"excerpt":"Building HTML5 games with Phaser has been somewhat of a hobby of mine over the past few years, and I will be writing a few tutorials about Phaser with a focus on developing HTML5 games for mobile. However, despite having created a few mostly finished games most of them never\u2026","rel":"","context":"In &quot;Phaser&quot;","block_context":{"text":"Phaser","link":"https:\/\/code4developers.com\/category\/phaser\/"},"img":{"alt_text":"phaser-starter-demo","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/phaser-starter-demo-1-300x227.gif?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3376,"url":"https:\/\/code4developers.com\/ionic-project-structure-installation\/","url_meta":{"origin":3412,"position":1},"title":"Ionic Project Structure and Installation","author":"Pratik Maniar","date":"April 1, 2018","format":false,"excerpt":"Ionic is a framework for web developers to develop a mobile application. It is used to create an hybrid application which works as an native apps. Using Ionic we can build mobile, web, and desktop applications with one shared code. In this getting started with Ionic article we will talk\u2026","rel":"","context":"In &quot;Ionic&quot;","block_context":{"text":"Ionic","link":"https:\/\/code4developers.com\/category\/ionic\/"},"img":{"alt_text":"Ionic","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/03\/Ionic-And-its-Tools-in-Brief-scaled.jpg?fit=1200%2C775&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/03\/Ionic-And-its-Tools-in-Brief-scaled.jpg?fit=1200%2C775&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/03\/Ionic-And-its-Tools-in-Brief-scaled.jpg?fit=1200%2C775&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/03\/Ionic-And-its-Tools-in-Brief-scaled.jpg?fit=1200%2C775&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/03\/Ionic-And-its-Tools-in-Brief-scaled.jpg?fit=1200%2C775&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2551,"url":"https:\/\/code4developers.com\/benefits-of-creating-progressive-web-apps\/","url_meta":{"origin":3412,"position":2},"title":"Benefits Of Creating Progressive Web Apps","author":"Yatendrasinh Joddha","date":"June 4, 2017","format":false,"excerpt":"Progressive Web Apps (PWA) are a concept of creating a Web site in such a way that it will behave and look like an application. Progressive Web Apps are created to fill the gap between mobile Applications and the Website. Key benefits No app store submission requirements It is quite\u2026","rel":"","context":"In &quot;Progressive Web Apps&quot;","block_context":{"text":"Progressive Web Apps","link":"https:\/\/code4developers.com\/category\/progressive-web-apps\/"},"img":{"alt_text":"PWA","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/02\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/02\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/02\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/02\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/02\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3225,"url":"https:\/\/code4developers.com\/why-progressive-web-apps\/","url_meta":{"origin":3412,"position":3},"title":"Why Progressive Web Apps?","author":"Yatendrasinh Joddha","date":"February 12, 2018","format":false,"excerpt":"What if I tell you, by creating a website\/webapp you can fulfill the requirement of having mobile application. Yes, that\u2019s true, the concept of creating such an app is called Progressive Web Apps. They called it Progressive because it builds with the core principle of Progressive Enhancement. In this article\u2026","rel":"","context":"In &quot;Progressive Web Apps&quot;","block_context":{"text":"Progressive Web Apps","link":"https:\/\/code4developers.com\/category\/progressive-web-apps\/"},"img":{"alt_text":"PWA","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/02\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/02\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/02\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/02\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/02\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3614,"url":"https:\/\/code4developers.com\/how-to-convert-wordpress-website-to-progressive-web-app\/","url_meta":{"origin":3412,"position":4},"title":"How to convert WordPress website to Progressive Web App","author":"Yatendrasinh Joddha","date":"May 17, 2018","format":false,"excerpt":"Progressive Web Apps are talk of the town, and your favorite Code4Developers is not far from using this feature. Yes, you read it true, we are now glittered with awesome features of Progressive Web Apps. In this article we will talk how and what we have done with this feature.\u2026","rel":"","context":"In &quot;Progressive Web Apps&quot;","block_context":{"text":"Progressive Web Apps","link":"https:\/\/code4developers.com\/category\/progressive-web-apps\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/04\/what-is-pwa-img.png?fit=1200%2C806&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3284,"url":"https:\/\/code4developers.com\/nativescript-and-angular-with-android-wear\/","url_meta":{"origin":3412,"position":5},"title":"JavaScript Running On A Wearable? Yes, And Its Native and Angular.","author":"Arif Khoja","date":"March 6, 2018","format":false,"excerpt":"A while ago i was Searching, if it\u2019s possible to use NativeScript and Angular with Android Wear. It\u2019s possible, easy to setup in 5 steps and\u00a0with FlexBox in NativeScript you can even handle small screens. NativeScript is a framework to build truly native apps for iOS and Android based on\u2026","rel":"","context":"In &quot;Angular&quot;","block_context":{"text":"Angular","link":"https:\/\/code4developers.com\/category\/angular\/"},"img":{"alt_text":"wearable-apps","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/03\/wearable-apps.png?fit=512%2C512&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/3412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/comments?post=3412"}],"version-history":[{"count":5,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/3412\/revisions"}],"predecessor-version":[{"id":3419,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/3412\/revisions\/3419"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/media\/3415"}],"wp:attachment":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/media?parent=3412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/categories?post=3412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/tags?post=3412"},{"taxonomy":"powerkit_post_featured","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/powerkit_post_featured?post=3412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}