Ad Unit3
Ad Unit3
Ad Unit3
• When people speak of a native mobile application, they are usually referring to an application that has
been written using the native development language and tools specific to that platform.
• For example: A native iOS application would be written in either Swift or Objective-C and compiled
using Xcode, while a native Android application would have been developed using Kotlin or Java and
compiled using Android Studio.
• Since these applications are developed using the platform’s default solutions, developers have full and
easier access to the device’s capabilities; like all the device’s sensors, the user’s address book, and
whatever the latest and greatest new bit of technology the phone offers.
• However, any application written for iOS using Swift cannot run on Android, and vice versa. Meaning,
you have to develop specifically for each platform, which can lead to a larger budget and team size,
assuming that you’d want to release your application for both iOS and Android.
• In addition, your application is only available through each platform’s app stores, subjecting it to their
respective rules and restrictions. This means for every release, whether it is a new feature or a bug fix,
the same approval process must occur. This can take anywhere from a day to two weeks for the Apple
App Store.
• For some, this uncertainty about having your application approved by faceless app-store gatekeepers
is too risky. There are also stories of top-tier applications running afoul of regulation and being
removed from the app store, which can cause a loss of revenue.
• Because of this, some developers have turned to building a web-only application, which gives them the
freedom to exist outside the app-stores and offer their application to other mobile and desktop users.
• These are just traditional web applications written in HTML, CSS, and JavaScript for which you can
leverage a wide range of frameworks and libraries, such as Angular, React, Vue, or even plain-vanilla
JavaScript. However, when taking this approach to development, your mobile application is restricted
to the capabilities of the user’s mobile browser . This means it will not have full access to the user
device for things like their address book and more. While this has improved over the years with access
to features like GPS and the camera, depending on the features needed for your application this could
also become an issue.
What is Hybrid Mobile App Development?
• Hybrid apps are a blend of both native and web solutions. Where the core of the application is written
using web technologies. This solution is a blend, hence the name hybrid, of both native and web
solutions. Where the core of the application is written using web technologies (HTML, CSS, and
JavaScript), which are then encapsulated within a native application. Through the use of plugins, these
applications can have full access to the mobile device’s features.
• The heart of a hybrid-mobile application is still just an application that is written with HTML, CSS, and
JavaScript. However, instead of the app being shown within the user’s browser, it is run from within a
native application and its own embedded browser, which is essentially invisible to the user.
• For example, an iOS application would use the WKWebView to display our application, while on
Android it would use the WebView element to do the same function.
• This code is then embedded into a native application wrapper using a solution like Apache Cordova
(also known as PhoneGap) or Ionic’s Capacitor.
• These solutions create a native shell application that is just the platform’s webview component in
which it will load your web application. This gives you the ability to create and publish true native
applications that can be submitted to each of the platform’s app stores for sale.
• Additionally, both Cordova and Capacitor have a plugin system that allows you to extend beyond the
limitations of the ‘browser’ and access the full suite of capabilities of a user’s mobile device.
• The only other consideration to take into account is if your application is still running within the
device’s native browser. If so, you may encounter performance issues or other quirks specific to each
platform or operating version.
Basically, Apache Cordova creates single screen in the native application and this screen consists a single
WebView that holds available space on the device screen. Cordova uses the native application WebView for
loading the application and its related JavaScript and CSS files.
Basic Components
The Cordova Application rely on the common config.xml file. This file provides the information about the
app and also specify the parameters that affect its working. It follows the W3C's Packaged Web App.
By default, this application is implemented like a web page that named as index.html that references the
resources (images, media files) necessary for running the application. The application executes as a Web
View with the native application wrapper which can be distributed to the app stores.
WebView:
A WebView provides user interface of a Cordova application and it can also be a component for some
platforms within a larger, hybrid applications. These applications mix the WebView with the native
application components.
Web App: A Web App is defined as a core part where the application code resides. It is simply a webpage
that is created using HTML, CSS and JavaScript. By default, a local file i.e., index.html is used to refer to CSS,
JavaScript, media files and other resources that are required to run the application. The app is mainly
executed in a WebView within the native application wrapper that are distributed to the app stores. This
container consists a key file i.e., config.xml that are responsible for providing the information about the
app. Cordova creates an app, in which the web app is initialized in a WebView i.e.,HTML Rendering Engine.
Plugins:
Plugins are defined as an integral part of the Cordova ecosystem that provides an interface for the Cordova
and the native components for communicating with each other. It also provides an interface for bindings
standard device APIs. It allows you to invoke the native code from JavaScript. Basically, the Apache Cordova
project defines a set of core plugins called Core Plugins. These plugins provide access to device capabilities
in the application such as camera, battery, contacts etc.
By using these plug-ins, the developers can easily link the JavaScript code to native code that is running in
the backend. In addition of these core plugins, there are several third-party plugins are available that
provide additional bindings to the features that are not necessarily available on all platforms.
How does it actually work?
When the application launches, firstly, Apache Cordova loads the application's default startup page (usually
index.html) in the application's WebView and passes its control to the WebView.
The WebView, allows the user to interact with the application by entering data in input fields, clicking on
the action buttons, and viewing results in the application's WebView.
To access the mobile's native functionalities such as audio or camera, Cordova provides a package of
JavaScript APIs that can be used by the developers from their JavaScript code. The calls to the Cordova
JavaScript APIs will translate into native device API calls by using a special bridge layer. The native APIs can
be accessed from the Apache Cordova plugins.
Cordova Development Workflows:
You can follow two basic paths when developing the Cordova:
Cross-platform workflow is used for deploying your application to different platforms with little or no
platform-specific development. Cordova Command-Line Interface is defined as a tool that support this
workflow and acts as a higher-level abstraction used for building your application compatible for different
platforms.
Platform-centered workflow is used for developing your application for a specific platform and helps to
modify code at a lower level by mixing the native components with Cordova components.
Command Line Interface:
The Command Line Interface (CLI) is responsible for creating a new Cordova application and deploy it
into various native mobile platforms. It is a text-based interface that mainly operates on various software
and operating systems. We can also use CLI to initialize the project code for which you can use various
platform's SDKs to develop the app further.
If you want to add any support or rebuild your project for any platform, you must require to run the
command line interface from the same machine which supports the platform's SDK.
Basically, it is available on the Command Prompt under Accessories on the PC. It also maintains a remote
source code repository through which you can run CLI from different machines.
The Command Line Interface consists some specific commands that are used to accelerate the mobile app
development, testing, and deploying the app to various mobile platforms. It can also execute the commands
for testing the hybrid mobile app with both real devices and emulators.
Before using the CLI tools, you must have to install the SDKs for each targeted mobile platform. These tools
can quickly be used by installing it as a npm package.
What role does CLI play in Cordova?
The Apache Cordova is fully dependent on CLI. It can't execute a single process without CLI. Basically, it is
used in following cases:
• To create a Cordova project.
• To generate the APK.
• To add the plugins.
• To provide a platform where we can develop an app.
IMPORTANT ASPECTS OF APACHE CORDOVA FRAMEWORK
Single Code Base:
• Cordova framework is capable to support different platforms like iOS, Android, Ubuntu and Windows. So,
a developer can build a single mobile app by targeting several mobile platforms.
• Cordova framework allows the developers to develop app in HTML5, CSS3, and JavaScript. Developer can
write a source code once and packed it for individual mobile platforms by using specific devices installer
format. This format enables the app to deliver native user experience by accessing native device
functionality like GPS, Bluetooth, Camera, Contacts etc.
App Templates
Cordova App Templates are used to accelerate hybrid mobile application development by using the pre-
existing code. The developer can choose templates from various sources i.e., npm, Git repository, etc.
Variety of Development tools
Cordova Framework is designed to be compatible with different mobile app development frameworks and
IDEs. Developers can create different mobile applications by using the popular tools like Ionic
Frameworks and IDEs like Visual Studio.
Shortcomings
Cordova Framework has its own shortcomings. To build the hybrid mobile apps, mobile app developers
address the shortcomings of Apache Cordova. Cordova Framework is used to reduce hybrid mobile app
development time and cost.
Cordova Installation
• To install the Cordova command line tool, you must have to follow below steps: Cordova basically
runs on the Node.js platform. So, you have to install Node.js as the first step.
Installing Node.js
• Step 1: Here is the link where you can easily install it -> http://nodejs.org The window that appears
after clicking on this link will be shown as follows:
You can install Node 12.14.0 LTS, which is recommended for most users.
After completing the installation, a pop-up window will appear. Consider the below screenshot:
If you want to test the installation, you can write following command on the command prompt:
node --version
If the version number is displayed on screen, it means that Node.js is properly installed on your
system.
Installing Git:
Step 1: To install the Git, you can visit its official website that are as follows: http://git-scm.com
Go ahead and follow the instructions on its official website. The web page will appear as:
Step 2: Click on the latest release version 2.24.1 for Windows. The pop-up window will be shown after
installation:
Accept the license agreement and click on the Next Button to continue.
Step 3: Here, you can select the path where you want to install Git and then click on the Next button
to continue.
Step 4: After that, you can specify the shortcut name that is displayed for the Start Menu folder and
then click on the Next button to continue.
Step 5: Default components required for installation are automatically selected. You can also select
your additional components.
Step 11: This is the last step that provides some additional feature that you want to add in your Git
application.