Mobile Application & Development Unit-1
Mobile Application & Development Unit-1
features
Unit-1
---------------------------------------------------------------------------------------------------------------
Contents:
---------------------------------------------------------------------------------------------------------------
Introduction to android:
What is Android?
Android is a stack of software for mobile devices that are an Operating System,
Middleware and Key Applications.
Operating System
Middleware
Key Applications
1) Linux kernel
It is the heart of android architecture that exists at the root of android architecture.
Linux kernel is responsible for device drivers, power management, memory management,
device management and resource access.
2) Native Libraries
Running on the top of the kernel, the Android framework was developed with various
features. It consists of various C/C++ core libraries with numerous of open source tools.
Some of these are:
1. The Android runtime:
The Android runtime consist of core libraries of Java and ART(the Android
RunTime). Older versions of Android (4.x and earlier) had Dalvik runtime.
3. WebKit:
This open source web browser engine provides all the functionality to display web
content and to simplify page loading.
GFGC Boy’s College, Kolar 3 By: Divakar M.S
Mobile Application & Development Unit 1- Android OS design &
features
4. Media frameworks:
These libraries allow you to play and record audio and video.
3) Android Runtime
In android runtime, there are core libraries and DVM (Dalvik Virtual Machine) which is
responsible to run android application. DVM is like JVM but it is optimized for mobile
devices. It consumes less memory and provides fast performance.
4) Android Framework
On the top of Native libraries and android runtime, there is android framework. Android
framework includes Android API's such as UI (User Interface), telephony, resources,
locations, Content Providers (data) and package managers. It provides a lot of classes and
interfaces for android application development.
1. Activity Manager:
It manages the activity lifecycle and the activity stack.
2. Telephony Manager:
It provides access to telephony services as related subscriber information, such as
phone numbers.
3. View System:
It builds the user interface by handling the views and layouts.
4. Location manager:
It finds the device’s geographic location.
5. Applications
On the top of android framework, there are applications. All applications such as home,
contact, settings, games, browsers are using android framework that uses android
runtime and libraries. Android runtime and native libraries are using linux kernal.
Note: If you don’t have Android SDK, you can download with Android studio. Go to the
end of download’s page and find android-studio-bundle-162.4069837-windows.exe it
includes SDK also.
have at least 500MB free space. For Android SDK installation, selected location must
have at least 3.25GB free space.
Step 6: Finish
This informs you installation has completed. Click Finish. Make sure Start Android
Studio is checked. Following splash screen of Android Studio will appear.
When you run it for the first time it will ask for Android Studio settings.
At the very first run it needs to download some necessary components, wait till it
completes.
GFGC Boy’s College, Kolar 10 By: Divakar M.S
Mobile Application & Development Unit 1- Android OS design
& features
1: Tool bar- It is collection of many tools like cut, copy, paste, run debug and others.
2: Navigation bar- It helps you to navigate through the recent open files of your
project.
3: Project hierarchy- It is the hierarchy of your project’s folders.
4: Component Tree- It shows component used in an activity in the form of a tree
structure.
5: Properties window- It shows properties of selected item on the screen.
6: Layout editor- It shows graphical layout, how your app will look like.
7: Palette window- Palette window shows component, layouts, and widgets available
in Android Studio.
This lesson shows you how to create a new Android project with Android Studio, and it
describes some of the files in the project.
2. In the Welcome to Android Studio window, click Start a new Android Studio
project.
After some processing time, the Android Studio main window appears.
First, be sure the Project window is open (select View > Tool Windows > Project) and
the Android view is selected from the drop-down list at the top of that window. You can
then see the following files:
app > java > com.example.myfirstapp > MainActivity
This is the main activity. It's the entry point for your app. When you build and
run your app, the system launches an instance of this Activity and loads its
layout.
This XML file defines the layout for the activity's user interface (UI). It contains
a TextView element with the text "Hello, World!"
The manifest file describes the fundamental characteristics of the app and
defines each of its components.
There are two files with this name: one for the project, "Project: My First App,"
and one for the app module, "Module: app." Each module has its
own build.gradle file, but this project currently has just one module. Use each
module's build.file to control how the Gradle plugin builds your app. For more
information about this file, see Configure your build.
In the previous section, you created an Android app that displays "Hello, World!" You
can now run the app on a real device or an emulator.
1. Connect your device to your development machine with a USB cable. If you developed
on Windows, you might need to install the appropriate USB driver for your device.
2. Perform the following steps to enable USB debugging in the Developer
options window:
a. Open the Settings app.
b. If your device uses Android v8.0 or higher, select System. Otherwise, proceed to the
next step.
c. Scroll to the bottom and select About phone.
d. Scroll to the bottom and tap Build number seven times.
e. Return to the previous screen, scroll to the bottom, and tap Developer options.
f. In the Developer options window, scroll down to find and enable USB debugging.
1. In Android Studio, select your app from the run/debug configurations drop-down menu
in the toolbar.
2. In the toolbar, select the device that you want to run your app on from the target device
drop-down menu.
1. Click Run .
Android Studio installs your app on your connected device and starts it. You now see
"Hello, World!" displayed in the app on your device.
Run on an emulator
1. In Android Studio, create an Android Virtual Device (AVD) that the emulator can use to
install and run your app.
2. In the toolbar, select your app from the run/debug configurations drop-down menu.
3. From the target device drop-down menu, select the AVD that you want to run your app
on.
4. Click Run .
Android Studio installs the app on the AVD and starts the emulator. You now see
"Hello, World!" displayed in the app.
Creating AVD’s
Step 3: A pop-up window will be there and here we select the category Phone because we are
creating android app for mobile and select the model of mobile phone we want to install.
Step 4: Here we select the android version to download like Q, Pie, Oreo etc and
click Next button.
Step 6: Now we can select the virtual device we want to run as emulator can click on
the run icon
Step 7: Finally our virtual device is ready to run our android app.
Android is an open-source operating system, based on the Linux kernel and used in
mobile devices like smartphones, tablets, etc. Further, it was developed for smartwatches
and Android TV. Each of them has a specialized interface. Android has been one of the best-
selling OS for smartphones. Android OS was developed by Android Inc. which Google bought
in 2005. In this article, we will discuss android application types and categories as well as
their advantages and disadvantages. Firstly let’s see the types of applications, there are
mainly 3 types of Android Applications.
Types of Android Applications
1. Native Apps
Native apps are built for particular operating systems, which are mostly Android and IOS.
Also, there are more OS for mobile applications: Blackberry and Windows. This is available for
download on Google Play Store and for IOS Apple App Store. Native apps are generally built to
make the most of all the features and tools of the phones such as contacts, cameras, sensors, etc.
Native apps ensure high performance and stylish user experience as the developers use the
native device UI to build apps. WhatsApp, Spotify, Pokemon GO, etc. are examples of Natives
apps. Android apps are built using Java, Kotlin, and Flutter, for the frontend, it uses
the XML scripting language. And IOS apps built using Swift, Flutter/ Dart, and C#.
Advantages:
Native apps are designed for the particular operating system and it gives the best user
experience.
Native apps are built with separate gestures it gives a good experience to users and it is very
useful for all users.
Disadvantages:
Native apps are costly in comparison to others because they want separate maintenance.
Requires a separate codebase to add new features.
2. Web Apps
Web applications are built only the run on browsers. They are mainly the integrations
of HTML, CSS, and Javascript. It runs on Chrome, Firefox, and other browsers. The
responsiveness and functionality of the web apps could easily be confused with a native app
since both the Native and web apps have almost the same features and responsive nature. And
one of the major differences between the two is that native mobile apps can function both in the
offline mode without an active internet connection and the online mode, whereas the web apps
require an active internet connection for them to work. Gmail, Canva, and Google Docs are the
best examples of web apps.
Advantages:
Easy to build
Web apps are used less storage than other applications.
Web Apps are preinstalled on all devices.
Web applications are easily accessible in any type of application.
Disadvantages:
Local resources are not available in web apps.
Depends on internet networks/ connections.
3. Hybrid Apps
Hybrid applications are also called Cross Platform Applications. Hybrid applications are
runs on multiple platforms like Android and IOS. Also, these are made from the integration of
web and native applications. Because hybrid apps use a single codebase, they can be deployed
across devices. For example, when we build the android application, we can also launch it on
IOS. As a cross-platform development option, developers have more freedom when designing
their applications as they do not need to stick to specific design guidelines from either apple or
google. Instagram, Uber, and Crypto change are examples of Hybrid apps. For Hybrid application
development, we use Flutter/Dart, React Native, etc.
Advantages:
Users can use it on more than one platform.
It is integrated with browsers.
Maintained by many versions.
Shareable code makes it cheaper than a native app.
Disadvantages:
Slower compared to native apps.
There might be some user interface issues.
In hybrid apps have limitations in using all the Hardware and Operating Systems features.
Now let’s see about some categories of Android applications.
1. E-Commerce Apps: E-commerce apps are an example of a B2B model. It helps to people to
sell and borrow different items and it saves time and money. In e-commerce applications,
we can do trading of commercial goods on online marketplaces. To buy specific items and
goods, you simply need to make electronic transactions like UPI, Phonepe, etc. through your
smartphone or computer. Flipkart, Amazon, OLX, and, Quiker are examples of e-commerce
applications.
2. Educational Apps: Educational apps are too much used to improve knowledge and peoples
get productivity. Apps for education can make people more interactive, more engaged, and
perform better. Keeping teaching methods good is integral to getting students engaged in
their studies and learning apps are a fantastic way of achieving this. For example, Google
Classroom, SoloLearn, edX, Duolingo, etc.
GFGC Boy’s College, Kolar 22 By: Divakar M.S
Mobile Application & Development Unit 1- Android OS design
& features
3. Social Media Apps: Social media apps give the opportunity to the peoples connect and
communicate together. These apps are mainly used for sharing purposes and making fun.
Many peoples use social media applications for influence, marketing/ business,
entrepreneurship, etc. Instagram, Facebook, WhatsApp, YouTube, LinkedIn, etc. are
examples of social media applications.
4. Productivity Apps: Productivity apps typically organize and complete complex tasks for
you, anything from sending an email to figuring out a tip. The easy-to-use Google Drive app
gives users access to all of the files saved to the cloud-based storage service across multiple
devices. Productivity applications arise in many different forms and they often take a
different approach to improving your workflow. For example, Hive, Todoist, Google Docs,
etc.
5. Entertainment Apps: Entertainment apps are widely used apps worldwide. It contains OTT
platforms and novels and other content. These platforms entertain people and give them
much more knowledge about different things. Everyone is watching OTT platforms and
those are trending these days, and their development is also in demand all over the world.
Hotstar, Netflix, and Amazon prime video are the best examples of this entertainments
applications.
Not all apps are built with the same approach. You have to brainstorm, plan and pick an
appropriate method before starting the development process. Before proceeding you will have
to make a prior move that your further app will be a Native, Hybrid, or Web-based app. There
are pros and cons of each of these development methods, having proper research will help you
better.
We all know that Coding is an Art. And once an individual starts coding correctly he/she starts
loving the flavor. Moreover how creatively you code, shows how better developer you are. Your
Quality Of Code Always Matters. Because writing long code is never a smart step, it not only
increases the chances of having more bugs and consumes a lot of time, and creates lots of
complexity. Here are few points listed you can adopt for superior code quality.
To give the finest look to your code you can initially study the code of an expert, analyze
their approach and try to modify that.
Provide the purposes of every function you use.
Android itself is a very vast concept, and it’s very much impractical to imagine that you are a
master in all the concepts and techniques. And when it comes to programming or building
application nothing can help you out other than the stack’s documentation. Learning how to
use/read and understand the Android Documentation is important this will help you to build
lots of applications with a variety of features.
5. User Input
Your project work seems more friendly if it’s highly interacted with the users and it seems more
helpful as well. While coding, every text field is planned for a different job. We take input in
some text fields as numbers or as alphabets. It is counted as better practice if only the number
pad is open if we ask the user for numeric value.
Having deep hierarchical code views actually makes the UI slower to manage the layout. Deep
hierarchies can mostly be avoided by using the correct view group. It’s a recommendation to
use a single-level hierarchy.
The duties of Developers are different that from Designers. For the maximum part, builders tend
to be great with technical concepts, whilst designers have recognition for being greater creative.
But with that said, you can’t have your blinders on while you’re growing an app. You want to
apprehend how the layout additives are going to create so that you can code the app
accordingly. To get designers and developers operating collectively and effectively, your whole
group desires to be on the identical page. You can use mood boards and lots of other tools to
have a thought and maintain the tracking of the design elements organized. This will make your
improvement manner plenty less difficult and decrease the possibilities of getting to make
masses of modifications overdue in the sport on the way to accommodate the designers. For the
ones of you that recognize a way to expand and layout, you should still sort out your design
elements in these early stages.
Always keep your Gradle updated and use the latest Gradle plugin for android.
Enable Offline mode, Gradle Daemon, and Parallel build of your project. to use Gradle
offline see the setting done below.
Use specific dependency versions instead of Dynamics versions.
Add below flags in gradle.properties
Be it a website or an app the way of picking a layout before developing your project. But
before we choose any layout we need to understand that how the UI of the project is created. So
when we talk about layouts as we know there are ConstraintLayout, LinearLayout,
RelativeLayout, FrameLayout, CoordinatorLayout, and out of all these layouts, you just need to
do performance analysis for some of them before getting started with it. If you have some part
of your XML getting reused and you want to Avoid replication of code in different layouts. Just
add <include/> by extracting them in a separate layout.
So, ADB is basically a tool that is not only used for reverse engineering but also by a lot of
android-tech enthusiasts but very few numbers its total potentials or use it at the fullest and is
mostly overlooked. ADB- a command-line tool or we can say a client-server program that lets
you communicate with android operating systems. Though developers are not using the
features of this tool daily or as quotidian, you can ease your lots of developing experiences. It
has lots of features like it can add or remove files/data from your android devices and also
address lots hidden of data with just a few clicks on your computer. Developers use these tools
for testing and making changes in android OS devices. If a user forgets his mobile password, we
can use ADB to delete the password file from the android directory, reboot it and the device is
unlocked.
No matter what sort of application the developer intended to make but security should
definitely be prioritized by the developer, from facts security clouds are one of the most
neglected because it’s not only a large concept but many seem to be imperfect with it. Your apps
will have tons of data and the sensitive information of your company as well as the users on
your app. Depending on the app you develop may have payment information crucial
information like home address, phone number, and many more things of a user-provided the.
Users will hesitate to provide you with information if your app isn’t secure. If security gets
breached, it could be so damaging to your brand that it will be tough to recover.
The android developer tools let you create interactive and powerful application for
android platform. The tools can be generally categorized into two types.
Platform tools
SDK tools
Platform tools
The platform tools are customized to support the features of the latest android
platform.
The platform tools are typically updated every time you install a new SDK
platform. Each update of the platform tools is backward compatible with older
platforms.
Some of the platform tools are listd below −
Android Debug bridge (ADB)
Android Interface definition language (AIDL)
aapt, dexdump and dex etc.
SDK tools
SDK tools are generally platform independent and are required no matter whichandroid
platform you are working on. When you install the Android SDK into your system, these
tools get automatically installed. The list of SDK tools has been givenbelow –
1 android
This tool lets you manage AVDs, projects, and the installed components of the SDK
2 Ddms
This tool lets you debug Android applications
3 Draw 9-Patch
This tool allows you to easily create a NinePatch graphic using a WYSIWYG editor
4 emulator
This tools let you test your applications without using a physical device
5 mksdcard
Helps you create a disk image (external sdcard storage) that you can use with the
emulator
6 proguard
Shrinks, optimizes, and obfuscates your code by removing unused code
7 sqlite3
Lets you access the SQLite data files created and used by Android applications
8 traceview
Provides a graphical viewer for execution logs saved by your application
9 Adb
Android Debug Bridge (adb) is a versatile command line tool that lets you
communicate with an emulator instance or connected Android-powered device.
2. DDMS
DDMS stands for Dalvik debug monitor server that provides many services on the device.
The service could include message formation, call spoofing, capturing screenshot,
exploring internal threads and file systems etc.
Running DDMS
From Android studio click on Tools>Android>Android device Monitor.
How it works
In android, each application runs in its own process and each process run in the
virtual machine. Each VM exposes a unique port, that a debugger can attach to.
3. Sqlite3
Sqlite3 is a command line program which is used to manage the SQLite databases
created by Android applications. The tool also allows us to executethe SQL
statements on the fly.
There are two ways through which you can use SQLite, either from remote shell
or you can use locally.
Building your First Android application.
Note:- Create an Android project (Refer page no 13 to 16 for more information)
Integrate your app’s various components and test their interactions. Test the
usefulness and dependability of your app by simulating diverse user interactions, edge
circumstances, and real-world scenarios. With the help of Android Studio’s emulators and
testing tools, you can test your app on various screen sizes, virtual devices, and Android
versions.