App Unit 2 Notes
App Unit 2 Notes
Native Web App, Benefits of Native App, Scenarios to create Native App, Tools for creating
Native App, Cons of Native App, Popular Native App Development Frameworks, Java
&Kotlin for Android, Swift & Objective-C for iOS, Basics of React Native, Native
Components, JSX, State, Props
A native app refers to a software program specifically written and created to work on
platforms and devices where it can be preinstalled, downloaded, configured, and updated to
the latest version via an app marketplace
A native application that is live on a device can be accessed through a home screen
icon. It alerts the user of notifications, and it is capable of functioning offline as well.
Since a native application has high compatibility with specified platforms, its users
can configure direct integration with the gadget’s hardware like microphone and camera.
Native apps have full access to operative systems or device features, which can be highly
customized.
Developers don’t have limitations; they can access all parts of hardware that help create a
unique user interface (UI) and user experience (UX).
For example, they can utilize a microphone function for sound effects or a camera for
filters.
Every platform has its own UI/UX guidelines developers must follow. With native
apps, these standards are rigorous, guaranteeing a consistent look and feel with the operating
system.
The consistency of native mobile apps provides a much more intuitive and interactive user
experience. Native apps are much faster and more efficient than web apps, which further
enhances the user experience.
Increased Scalability
Native apps offer increased scalability, they can easily handle an increase in the
number of users or amount of data being processed without sacrificing performance.
Fewer Bugs
Native apps are designed for a specific operating system, such as iOS and Android,
and they use programming languages and software development tools optimized for that
platform.
Compared to web apps, which are designed to run on multiple platforms and may have
compatibility issues, native apps result in fewer bugs and errors, providing a more stable and
reliable user experience and leading to higher user satisfaction and retention.
Instant Updating
Android and iOS frequently release updates and developers must instantly implement
them into the apps to preserve a satisfying user experience. This struggle doesn’t affect native
apps because they have instant updates.
Unlike cross-platform apps, native apps will work even when the Internet is
unavailable. For example, you are driving, and the Internet is not stable en route.
When built using the native app development approach, this app will run even though
there is no stable connection.
Development
Developing a native app is a difficult process since separate developers are needed for
each platform. For an example, different developers must be hired to develop Android and
Time Consumption
Since native apps are developed for multiple platforms, it requires more time. Native
apps may require significant amount of time for making compared to their counterparts.
Developers of native app have to take time to write codes for specific O/S.
Updates
Developers often come up with new updates in native apps for various reasons. Most
often for fixing bugs and glitches. Hence, necessary updates needs to be implemented
in app store so that so that users will be able to download them. Now the problem comes if
the user isn’t aware of such updates or skips them to save storage space.
Download Requirement
Prior to using a native app, it is a must to download it from either App store or Plays
store. There are several process involved in downloading a native app. They must find the
app, go though the terms & conditions and then go with the download process. Sometimes
the download process can be lengthy that the users wouldn't have patience.
While the regular introduction of newer versions and upgrades is necessary to fix
bugs and rectify errors and malfunctions, it can be tedious and disruptive for the end users.
On top of that, these updates also take up a sizeable amount of device storage space.
Native app developers can charge for every download. The payment process will go
through the app store or shop which will take a percentage of the fees.
Having a concept for native mobile apps is not enough; you need to validate it for the
app market. Check if people are ready to embrace the mobile app you plan to develop.
Also, identify the following points to validate your idea clearly.
Planning for user experience is one of the most crucial steps of native app
development. Apart from this, You should identify your users, how they operate mobile apps,
and what makes them tick.
It is equally important to know how they hold their phones, what apps they mostly use, and
what makes them love these apps.
Whether you are building hybrid apps or developing separate apps for Android and
iOS devices, having a monetization strategy comes in handy. It will help you realize how you
aim to translate your mobile app into a profitable business.
As native app developers, you can plan to have a subscription strategy or in-app
advertisements to generate revenue. You can also use the freemium method to build a more
profitable mobile app.
The Apple app store has a clear definition of a secure app. While the underlying technology
for both Android and iOS devices is secure, you should work in sync with the guidelines laid
by the app stores.
It will help build highly secure apps for the different platforms. Native apps generally are
considered to be safe and data-protective. However, you cannot take your chances.
• Check for all the data precautions you need to take with the particular platform
• Identify the compliances you need to include in the specific operating system
Xamarin:
Xamarin is also one of the most popular open-source frameworks used to develop
mobile applications. The framework, acquired by Microsoft, is based on .Net and allows you
to build native applications for Android, iOS, and Windows platforms. Xamarin comes with
almost every required tool and library needed to build native applications and offers you to
create rich experiences using native UI elements. Moreover, Xamarin also supports the
Features:
• Fast development
• Built-in material design
• Increased time-to-Market speed
• Rich motion APIs
• Own rendering engine
• Strong widget support
• Similar to Native app performance
Examples:
• Alibaba
• Google Ads
• Reflectly
• Cryptography
Swift Objective C
• Clean code and fewer bugs and • It is compatible with C and C++ programming
Fast speed applications languages
• High performance and rapid • Been in use for several years; has a strong
application development community
• Auto tracking of memory usage • Flexible coding environment
Kotlin
Kotlin is also an object-oriented programming language just like Java developed by
JetBrains. It is a general-purpose, open-source, sterically-typed, cross-platform pragmatic
programming language with type inference. It is particularly designed to interoperate with
Java and also to improve the existing Java models by offering solutions to API design
deficiencies.
Why Kotlin?
Pros
Cons
Primitive Type Primitive types in Java are not objects. Primitive types are objects.
Compilation Java's compilation time is pretty fast. Its compilation time is slow in comparison
Time to Java.
File Extensions Java uses the extensions: .java (for source Kotlin uses the extensions: .kt (for Kotlin
file), .class (for class file), .jar (for archived source file), .kts (for Kotlin script
file). file), .ktm (for Kotlin module)
Checked In Java, we take care of the checked exception There is no need to catch or declare any
Exceptions by using the try-catch block. exception.
Concise The code is not concise in comparison to Kotlin. It reduces the boilerplate code.
Extension We need to create a new class and inherit the We can extend a class with new
Widening Java supports the implicit conversion so we can Kotlin does not support the implicit
Conversion convert a smaller type to a bigger one. conversion. So, we cannot convert the
smaller type to a bigger one.
Code The line of code is just doubled than Kotlin. It reduces the line of code to half.
Comparison
Community Java provides a very large community. Its community is not so huge as Java.
Support
Casting In Java, we need to identify and perform the Kotlin supports the smart cast, which
casting. means that it identifies the immutable type
and performs implicit casting
automatically.
Type interface It is mandatory to specify the data type, It is not mandatory to specify the type of
explicitly. variable, explicitly.
Null Values We can assign null values to variables but We cannot assign null values to any
cannot assign null values to an object. variable and objects.
Coroutines Multithreading feature of Java makes it more Like Java, we can create multiple threads
Support complex because managing the multiple threads (long-running intensive operations) in
is a difficult task. Java blocks the thread if we Kotlin also but coroutine can suspend a
initiate a long-running intensive operation like thread execution at a certain point without
network I/O or CPU operations. blocking the other threads.
Data Classes If we need a class that can hold data only, for If we want to do the same in Kotlin, we
this we need to define getter, and setter declare the class with the keyword Data.
methods, constructors, and other functions. Rest the work such as creating
constructor, getter, and setter methods for
the fields are done by the compiler.
DOM
When an instance of a component is being created and inserted into the DOM, it gets
properties, or props, and from now on they can be accessed using this.props.
Mounting
These methods are called in the following order when an instance of a component is being
created and inserted into the DOM:
• constructor()
• static getDerivedStateFromProps()
• render()
• componentDidMount()
An update can be caused by changes to props or state. These methods are called in the
following order when a component is re-rendered:
• static getDerivedStateFromProps()
• shouldComponentUpdate()
• render()
• getSnapshotBeforeUpdate()
• componentDidUpdate()
Unmounting
These methods are called when there is an error during rendering, in a lifecycle
method, or in the constructor of any child component.
• static getDerivedStateFromError()
• componentDidCatch()
constructor()
the constructor method is called before mounting to the DOM and rendering.
• constructor initialize state and bind event handler methods within the
constructor method.
• This is the first part of the lifecycle and is only called when it is explicitly
declared,
• I will introduce it later on as we are going through each method the in order they are
invoked.
ComponentDidUpdate()
• componentDidUpdate() is invoked immediately after updating occurs.
• This method is not called for the initial render.
• This is also a good place to do network requests as long as you compare the current
props to previous props
• (e.g. a network request may not be necessary if the props have not changed).
Unmounting
componentWillUnmount()
• componentWillUnmount() is invoked immediately before a component is unmounted
and destroyed.
• Perform any necessary cleanup in this method, such as invalidating timers, canceling
network requests, or cleaning up any subscriptions that were created
in componentDidMount().
static getDerivedStateFromError()
• Whatever value is returned from this method is used to update the state of the
component.