0% found this document useful (0 votes)
44 views25 pages

CH-1 Android OS Design and Features-1

The document provides an overview of the Android operating system, including its design, features, and development framework. It discusses the history of Android, the Open Handset Alliance, and various categories of mobile applications, as well as tools for mobile app development. Additionally, it outlines the Android SDK, installation instructions for Android Studio, and the process for creating Android Virtual Devices (AVDs).

Uploaded by

khazifarru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views25 pages

CH-1 Android OS Design and Features-1

The document provides an overview of the Android operating system, including its design, features, and development framework. It discusses the history of Android, the Open Handset Alliance, and various categories of mobile applications, as well as tools for mobile app development. Additionally, it outlines the Android SDK, installation instructions for Android Studio, and the process for creating Android Virtual Devices (AVDs).

Uploaded by

khazifarru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Chapter: - 1

Android OS design and Features

What is Android?
Android is a mobile operating system that is based on a modified version of Linux. It
was originally developed by a startup of the same name, Android Inc.

The main advantage of adopting android:

➢ It offers a unified approach to application development.


➢ Developers need only develop for Android, and their applications can run on numerous
different devices based on Android OS.

What is an operating system?

An operating system is a software program that acts as intermediary between the user and
the computer hardware.

Operating system enables the hardware to communicate and operate with software.
Operating system also provides a software platform on top of which other programs called
Application program can run.

User

Applications

Operating system

Hardware

What is Linux?
Linux is a family of free and open-source software operating system built around Linux
kernel.

Linux kernel is a core of Linux operating system, acts as a bridge between computers
hardware and its software application.

Ex: Memory allocation, process scheduling and device drivers So on.


What is Open Source?

Open-source means license free and freely available to the public. User can view and make
any kind of changes to it.

Android history

➢ Initially, Andy Rubin founded Android incorporation with Rich Miner, Nick Sears, Chris
white in Palo Alto, California, United States in October 2003.
➢ Andy Rubin is a father of android platform his company Android Inc, was acquired by
Google on 17th August 2005 for $50M.

The Open Handset Alliance (OHA)


➢ The OHA was formed in November 2007.
➢ The OHA is a business alliance, consists of many of the largest and most successful
mobile companies and include chip makers, Handset manufacturers, Software
developers and service providers. The entire mobile supply chain is well represented.
➢ Google has shown an interest in spreading its vision, its brand, its search, and AD-
revenue-Based platform.
➢ Google hosts the android open-source project and provides online android
documentation, tools, forums, and Software Development Kit (SDK) for developers.
➢ Handset manufacturers like Samsung, Motorola, HTC, and LG and Semiconductor
companies such as Intel, Texas instruments, NVIDIA and Qualcomm, these companies
are helping design the first generation of android handsets.
➢ The first shipping android handset is T-Mobile G1 was developed by handset
manufacturer HTC with service provided by T-Mobile released in October 2008.
➢ In between 2009 and 2010, over the following 18 months 60 different android handsets
made by 21 different manufacturers debuted across 59 carriers in 48 countries around
the world.

Android Versions history


Categories of mobile applications

In terms of how applications work on a smartphone, mobile apps may be divided into three

categories.

1) Native Apps

Native Apps are designed for specific operating systems such as Android, iOS,

and Windows. Apps make use of device features such as RAM, camera, GPS, and so on.

2) Web Apps

Web apps, or web applications, are software programs that run directly in a web browser.

They do not require any downloads or installations on your device. Instead, you can access

them via the internet.

3) Hybrid Apps

Hybrid Apps that combine features from native apps and with components from

web apps. These apps are designed to work on multiple platforms, such as Android

and iOS, using a single codebase.

Mobile App Development Tools


Mobile app development tools are software designed to support in the creation of mobile

applications. This can be accomplished in multiple ways.

1. Native Mobile App Development Tools

A native development tool is a software which allows developers to create applications

for use in a single system family, platform, or device, like Android, iOS, or Windows.

A native app is specially made and coded for a specific mobile platform in its native

programming language.

Ex: iOS (Objective-C or Swift), Android (Java or Kotlin)

Examples- Xcode, Android Studio, AppCode etc.

2. Cross-Platform Mobile App Development Tools


With cross-platform mobile development, programmers on one platform can develop

apps for one or more other platforms or mobile operating systems simultaneously. This can

also enable developers to essentially use the same code base for different platforms.

Ex: flutter, react native, adobe phoneGap.

Features of Android

As android is open source and freely available to manufacturers for customization,


there are no fixed hardware and software configuration. However, android itself supports the
following features.

➢ Storage: Uses SQLite, a lightweight relational database, for data storage.

➢ Connectivity: Supports GSM/EDGE, NFC, CDMA, EV-DO, UMTS, Bluetooth (includes

A2DP and AVRCP), Wi-Fi, LTE, hotspot, volte, and WiMAX.

➢ Multiple Language Support- Android supports multiple languages in its operating system

and one can change the language very easily based on one’s requirement.

➢ Messaging: Supports both SMS, MMS, and RCS chats.

➢ Web browser: Based on the open-source Web Kit, together with Chrome’s V8 JavaScript

engine.

➢ Media support: Includes support for the following media: H.263, H.264 (in 3GP or MP4

container), MPEG-4 SP, AMR, AMR-WB (in 3GP container), AAC, HE-AAC (in MP4 or 3GP

container), MP3, MIDI, Ogg, WAV, JPEG, PNG, GIF, and BMP

➢ Hardware support: Accelerometer Sensor, Camera, Digital Compass, Proximity Sensor,

and GPS

➢ Multi-touch: Supports multi-touch screens.

➢ Multi-tasking: Android provides support to run apps and services in the background with ease

which allows the users to use multiple apps at the same time.

➢ Tethering: Supports sharing of Internet connections as a wired/wireless hotspot.


➢ Android Beam-A popular NFC-based technology that lets users instantly share, just by touching

two NFC-enabled phones together.

➢ Automation-Some apps allow you to automate your tasks by granting them controls of those

apps.

➢ Widgets-Android widgets let you display just about any feature you choose on the home screen,

including weather apps, music widgets, or productivity tools.

➢ Custom ROMs-Because the Android operating system is open-source, developers can twist the

current OS and build their versions, which users can download and install in place of the stock

OS.

Android development framework


The Android OS is roughly divided into five sections in four main layers as shown in Figure.
1. Linux kernel:

This is the kernel on which Android is based. This layer contains all the low level

device drivers needed during the runtime of an Android device, such as camera drivers, display

drivers, audio drivers, Bluetooth drivers, and memory drivers, among others.

Its main features are:

• Security: The Linux kernel maintains the security between an application and the

host system.

• Memory Management: It efficiently manages memory, which allows us to develop

our own applications without having to worry about memory allocation.

• Process Management: It effectively manages the workflow process and allocates

resources when required by processes.

• Network Stack: It can handle network communications effectively and efficiently.

• Multitasking: One of the main features of Linux is its support for pre-emptive

multitasking. As a multitasking operating system with asynchronous execution,

it enables multiple processes to share the same processors (CPUs) and other

resources one at a time.

2. Libraries:

• The library provides the device with a set of instructions that allow it to handle different

types of data in an appropriate way. It is a collection of C/C++ core libraries as well as

Java-based libraries, which support Android development.

• Some key Android libraries that are available for Android development,

▪ App: Provides access to the application model and is the foundation of all Android

applications.

▪ OpenGL: A Java interface to the OpenGL ES 3D graphics rendering API.

▪ OS: Provides applications with access to standard operating system services,

including messages, system services and inter-process communication.


▪ Media: Media library provides support to play and record an audio and video

format.

▪ SQLite: It provides database support.

▪ Free Type provides font support.

▪ SSL: Secure Sockets Layer is a security technology to establish an encrypted link

between a web server and a web browser.

▪ The Web Kit library provides functionalities for web browsing.

3. Android runtime:

• At the same layer as the libraries, the Android runtime provides a set of core

libraries that enable developers to write Android apps using the Java

programming language.

• The Android runtime also includes the Dalvik virtual machine (DVM), which

enables every Android application to run in its own process, with its own instance

of the Dalvik virtual machine (Android applications are compiled into the Dalvik

executables).

• Dalvik is a specialized virtual machine designed specifically for Android and

optimized for battery-powered mobile devices with limited memory and CPU.

4. Application Framework:

Exposes the various capabilities of the Android OS to application developers so that

they can make use of them in their applications. Which include,

• Activity Manager: Plays a crucial role in bringing all aspects of the applications lifecycle

and activity stack under control.

• Content Providers: These providers enable applications to publish data online and share

it with other applications.

• Resource Manager: Assists in accessing non-code embedded resources such as strings,

color settings, and layouts for user interfaces.


• Notifications Manager: Allows applications to show alerts and notifications to users via

the user interface of the application.

• View System: It serves as a base class for widgets and handles events.

5. Applications:

• At this top layer, you will find applications that ship with the Android device

(such as Phone, Contacts, Browser, etc.), as well as applications that you

download and install from the Android Market.

• Any applications that you write are located at this layer.

Android SDK

The Android SDK (software development kit) provides a selection of tools that are required to
build Android applications and ensures the process goes as smoothly as possible. Whether
you create an application using Java, Kotlin or C#, you need the SDK to get it to run on any
Android device. You can also use an emulator to test the applications that you have built.

The Android SDK includes the following:

• Required libraries.
• Debugger.
• An emulator.
• Relevant documentation for the Android application program interfaces (APIs).
• Sample source code.
• Tutorials for the Android OS

Features of Android SDK

1. Insightful APK Analyzer- Helps to optimize your Android app size by inspecting the
contents of your app APK file or Android App Bundle. Inspect the manifest file,
resources, and DEX files. Compare two APKs or Android App Bundles to see how your
app size changed between app versions.
2. Fast Emulator- Install and run your apps faster than with a physical device and simulate
different configurations and device types, including Tablets, Wear OS, Android
Automotive, and Android TV.
3. Intelligent Code Editor- Helps write a better code, work faster, and be more productive
with an intelligent code editor that provides code completion for Kotlin, Java, and
C/C++ programming languages.
4. Flexible build system- Android Studio's build system lets you customize your build to
generate multiple build variants for different Android devices from a single project.
Then analyze the performance of your builds and understand where potential build
issues exist in your project with the Build Analyzer.
5. Real-time Profilers- The built-in profiling tools provide real-time statistics for your
app's CPU, memory, and energy usage activity.
6. Offline maps- SDK helps in dynamically downloading the maps for more than 190
countries in over 60 languages. You can view these offline. Also dealing with the map
styles and the touch gesture.

Installing and running applications on android studio


Download Android Studio for Windows

1. Open any web browser and navigate to the Android Studio download page.

2. This is the Android Developers website, where you can download Android Studio. This
page automatically detects your operating system.
3. Click Download Android Studio. The Terms and Conditions page with the Android
Studio License Agreement opens.
4. Read the License Agreement.
5. At the bottom of the page, if you agree with the terms and conditions, select the I have
read and agree with the above terms and conditions checkbox.
6. Click Download Android Studio to start the download.
7. When prompted, save the file to a location where you can easily locate it, such as the
Downloads folder.
8. Wait for the download to complete. This may take a while and may be a good moment
to enjoy some tea!

Install Android Studio on Windows

1. Open the folder where you downloaded and saved the Android Studio installation file.
2. Double-click the downloaded file.
3. If you see a User Account Control dialog about allowing the installation to make
changes to your computer, click Yes to confirm the installation.

4. The Welcome to Android Studio Setup dialog displays.


5. Click Next to start the installation.
6. Accept the default installation settings for all steps.
7. Click Finish when the installation is done to launch Android Studio.

8. Choose your preference of light or dark theme when Android Studio first launches.
Screenshots in this course use the light theme but choose whichever one you prefer.
9. During the installation, the setup wizard downloads and installs additional components
and tools needed for Android app development. This may take some time depending
on your internet speed. During this time, you may see a User Account Control Dialog
for Windows Command Processor. Click Yes to accept the dialog.

10. You may also receive a Windows Security Alert about adb.exe. Click Allow Access,
if needed, to continue the installation.

11. When the download and installation complete, click Finish.


12. When the download and installation complete, click Finish.
Creating AVDs
The Android Virtual Device Manager is used to create and manage the virtual devices that will
host instances of the Emulator.

AVDs are used to simulate the software builds and hardware configurations available on
different physical devices. This lets you test your application on a variety of hardware platforms
without needing to buy a variety of phones.

How to create Android Virtual Device (AVD)

Creating an Android Virtual Device (AVD) in Android Studio is a straightforward process. Here
is how you can do it:

1. Open the AVD Manager:


2. From the Android Studio Welcome screen, select “More Actions” and then “Virtual Device
Manager.”
3. If you have a project open, go to the main menu bar, select “View” > “Tool Windows” >
“Device Manager.”

4. Create a New AVD:


5. In the Device Manager, click on the “Create device” button. The “Select Hardware”
window will appear.
6. Choose a hardware profile for your virtual device and click “Next.”

7. Select a System Image:


8. Choose a system image for your AVD. You might need to download the system image
by clicking the download icon next to it.
9. After selecting the system image, click “Next.”
10. Configure the AVD:

11. You can now configure the properties of your AVD, such as the orientation, scale,
and RAM allocation.
12. Once you have configured the settings, click “Finish.”

Types of android applications


Most of the applications you create in Android will fall into one of the following
categories:

1. Foreground — An application that is useful only when it is in the foreground and is


effectively suspended when it is not visible. Games are the most common examples.
2. Background — An application with limited interaction that, apart from when being
configured, spends most of its lifetime hidden. These applications are less common,
but good examples include call screening applications, SMS autoresponders, and alarm
clocks.
3. Intermittent — Most well-designed applications fall into this category. At one extreme
are applications that expect limited interactivity but do most of their work in the
background. A common example would be a media player. At the other extreme are
applications that are typically used as foreground applications but that do important
work in the background. Email and news applications are great examples.
4. Widgets and Live Wallpapers — Some applications are represented only as a home-
screen Widget or as a Live Wallpaper.

Best practices in android programming


Following to best practices in Android programming is crucial for building high-quality,
maintainable, and user-friendly applications.

Here are some key best practices to consider:

1) Choose the Right Development Method: Decide whether your app will be native, hybrid,
or web-based, as each has its own set of advantages and disadvantages.
2) Maintain High Code Quality: Write clean, readable, and maintainable code. Use tools
like Proguard to minimize APK size by removing unused code.
3) Consistent Coding Style: Use descriptive names and keep your code simple.
Consistency in coding style makes it easier for others to understand and maintain your
code.
4) Understand Android Documentation: Familiarize yourself with Android’s official
documentation to stay updated on the latest features and best practices.
5) User Input Handling: Design your app to handle user input intelligently, such as opening
the number pad for numeric inputs.
6) Architecture Recommendations: Follow a layered architecture that separates concerns,
complies with the single source of truth principle, and adheres to unidirectional data
flow principles.
7) Use Android Jetpack: Utilize the suite of libraries and tools provided by Android Jetpack
to follow best practices and reduce boilerplate code.
8) Testing: Implement thorough testing practices to ensure your app works well across
different devices and Android versions.
9) Security and Privacy: -Always prioritize user security and privacy. Store sensitive data
securely and request permissions responsibly.
10) Performance Optimization: Monitor your app’s performance and optimize it to
run smoothly, reducing battery consumption and memory usage3.
11) Responsive Design: Ensure your app provides a good user experience on different
screen sizes and resolutions.
12) Continuous Learning: The Android platform is constantly evolving, so it is
important to keep learning and adapting to new technologies and methodologies4.
Android tools

Android development involves a variety of tools that cater to different aspects of


building an app. Here are some essential tools used in Android development:

1. Android Studio: The official Integrated Development Environment (IDE) for Android app
development, providing code editing, debugging, performance tooling, a flexible build
system, and an instant build/deploy system1.
2. SDK Platform Tools: These include essential tools such as ADB (Android Debug Bridge)
and fast boot, which are used for debugging and interacting with Android devices2.
3. Gradle: The build automation system that Android Studio uses to manage dependencies
and build processes.
4. Jetpack Compose: A modern toolkit for building native UIs in Android Studio, allowing
developers to create dynamic layouts with less code.
5. Android Virtual Device (AVD) Manager: Part of Android Studio, it allows developers to
emulate Android devices for testing purposes.
6. ProGuard: A tool that helps to minimize and obfuscate the code in an Android
application to make it harder to reverse engineer.
7. Android SDK Manager: Allows developers to download tools, platforms, and other
components needed for Android development.
8. Android Device Monitor: Provides a graphical interface for monitoring and managing
Android devices during debugging.
9. Firebase: A suite of cloud services that provides functionalities like analytics, databases,
messaging, and crash reporting.
10. Android Jetpack: A collection of libraries, tools, and architectural guides to help
make it quick and easy to build great Android apps.

Building your first android application


To create a project in Android Studio:

1. Double click the Android Studio icon to launch Android Studio.


2. In the Welcome to Android Studio dialog, click New Project.

3. The New Project window opens with a list of templates provided by Android Studio.

4. In Android Studio, a project template is an Android project that provides the blueprint
for a certain type of app. Templates create the structure of the project and the files
needed for Android Studio to build your project. The template that you choose provides
starter code to get you going faster.
5. Make sure the Phone and Tablet tab is selected.
6. Click the Empty Activity template to select it as the template for your project. The Empty
Activity template is the template to create a simple project that you can use to build a
Compose app. It has a single screen and displays the text "Hello Android!".
7. Click Next. The New Project dialog opens. This has some fields to configure your
project.
8. Configure your project as follows:
9. The Name field is used to enter the name of your project, for this codelab type "Greeting
Card".
10. Leave the Package name field as is. This is how your files will be organized in the
file structure. In this case, the package name will be com.example.greetingcard.
11. Leave the Save location field as is. It contains the location where all the files
related to your project are saved. Take a note of where that is on your computer so that
you can find your files.
12. Select API 24: Android 7.0 (Nougat) from the menu in the Minimum SDK field.
Minimum SDK indicates the minimum version of Android that your app can run on.

13. Click Finish. This may take a while - this is a great time to get a cup of tea! While
Android Studio is setting up, a progress bar and message indicates whether Android
Studio is still setting up your project. It may look like this:

14. A message that looks like this informs you when the project set up is created.
15. You may see a What's New pane which contains updates on new features in
Android Studio. Close it for now.

16. Click Split on the top right of Android Studio, this allows you to view both code
and design. You can also click Code to view code only or click Design to view design
only.
17. After pressing Split you should see three areas:

18. The Project view (1) shows the files and folders of your project.
19. The Code view (2) is where you edit code.
20. The Design view (3) is where you preview what your app looks like
21. In the Design view, you will see a blank pane with this text:

22. Click Build & Refresh. It may take a while to build but when it is done the preview
shows a text box that says, "Hello Android!". Empty Compose activity contains all the
code necessary to create this app.
Android Activity Lifecycle

Activity is a screen that user interact with, every activity in Android has lifecycle like
Create, Start, Resume, Pause, Stop, Destroy and Restart.

Android activity lifecycle methods


Method Description
onCreate () Called when activity is first created.
onStart() Called when activity is becoming visible to
the user.
onResume() Called when activity will start interacting
with the user.
onPause() Called when activity is not visible to the
user.
onStop() Called when activity is no longer visible to
the user.
onRestart() Called after your activity is stopped, prior to
start.
onDestroy() Called before the activity is destroyed

You might also like