0% found this document useful (0 votes)
8 views23 pages

Unit-1 Notes Mobile App. Dev

Android is a mobile operating system developed by Google, primarily for touchscreen devices, and is based on the Linux kernel. It features an open-source nature, extensive customizability, and supports a wide range of devices, making it one of the most widely used operating systems globally. The Android platform includes various components such as the Android OS, runtime, framework, and development tools, facilitating the creation and operation of applications across diverse hardware.

Uploaded by

Paul Liza
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)
8 views23 pages

Unit-1 Notes Mobile App. Dev

Android is a mobile operating system developed by Google, primarily for touchscreen devices, and is based on the Linux kernel. It features an open-source nature, extensive customizability, and supports a wide range of devices, making it one of the most widely used operating systems globally. The Android platform includes various components such as the Android OS, runtime, framework, and development tools, facilitating the creation and operation of applications across diverse hardware.

Uploaded by

Paul Liza
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/ 23

Andriod

An Android, in the context of mobile technology, refers to a mobile operating


system (OS) developed by Google. It is designed primarily for touchscreen
devices such as smartphones and tablets. Android is based on the Linux kernel
and other open-source software, and it is one of the most widely used mobile
operating systems in the world.
Key Features of Android
1.​ Open Source:
o​ Android is open-source, meaning that the source code is available
for developers to view, modify, and distribute. The Android Open
Source Project (AOSP) is responsible for maintaining and
developing Android's core.
2.​ Versatility:
o​ Android supports a wide range of hardware platforms, including
smartphones, tablets, smartwatches, TVs, cars, and more. This
versatility has contributed to its widespread adoption.
3.​ Customizability:
o​ One of the key strengths of Android is its customizability. Device
manufacturers and users can customize the interface and
functionality extensively. This has led to a wide variety of user
experiences across different Android devices.
4.​ Google Play Store:
o​ The Google Play Store is the official app store for Android devices,
offering a vast selection of apps, games, music, movies, books, and
more. It provides a platform for developers to distribute their apps
to a global audience.
5.​ Integration with Google Services:
o​ Android devices often come preloaded with Google services such
as Gmail, Google Maps, Google Drive, YouTube, and Google
Assistant, providing seamless integration with Google's ecosystem.
6.​ Multi-tasking:
o​ Android supports multi-tasking, allowing users to run multiple
applications simultaneously. Features like split-screen mode
enhance the multitasking experience.
7.​ Security:
o​ Android includes various security features, such as sandboxing
applications, regular security updates, and encryption. Google Play
Protect also scans apps for malware and vulnerabilities.
8.​ Wide Range of Devices:
o​ Android is used by numerous manufacturers, resulting in a wide
range of devices available at different price points and with diverse
hardware specifications.
9.​ Frequent Updates:
o​ Android is continually updated, with major releases bringing new
features, enhancements, and security improvements. These updates
are named after desserts or sweets in alphabetical order (e.g.,
Lollipop, Marshmallow, Nougat), though more recent versions use
a numerical naming system (e.g., Android 10, Android 11).
History and Evolution
●​ Android was initially developed by Android Inc., which Google acquired
in 2005. The first commercial Android device, the HTC Dream (also
known as the T-Mobile G1), was released in 2008.
●​ Since then, Android has evolved significantly, adding features like
multi-touch, improved user interfaces, better performance, and enhanced
security measures.
Andriod Platform
The Android platform refers to the entire ecosystem that includes the
Android operating system, its associated software, development tools,
services, and devices that use this system. It's a comprehensive
framework for developing and running applications on a wide range of
devices, from smartphones and tablets to smart TVs, watches, cars, and
more.
Key Components of the Android Platform
1.​ Android Operating System (OS):
o​ The core component of the Android platform is the operating
system itself, which is based on the Linux kernel. The OS includes
the user interface, system libraries, and core functionalities that
support app development and device operation.
2.​ Android Runtime (ART):
o​ ART is the managed runtime used by the Android OS to execute
applications. It includes features like ahead-of-time (AOT)
compilation, just-in-time (JIT) compilation, and garbage collection
to manage memory and optimise app performance.
3.​ Android Framework:
o​ The framework provides APIs for developers to build apps. It
includes components like:
▪​ Activity Manager: Manages the lifecycle of applications
and activities.
▪​ Window Manager: Manages the user interface and
windowing system.
▪​ Content Providers: Enable data sharing between
applications.
▪​ Resource Manager: Manages application resources like
layout files, strings, and graphics.
4.​ Application Layer:
o​ This is where all the apps reside, both pre-installed system apps
and third-party apps downloaded by users. These applications
interact with the underlying hardware through the Android
framework.
5.​ Google Play Services:
o​ A set of APIs and services provided by Google that enhance app
functionality. It includes services like location tracking,
authentication, cloud storage, and messaging.
6.​ Google Play Store:
o​ The official app store for the Android platform, where users can
browse and download apps, games, and other digital content. It
also provides developers with a platform for distributing their apps.
7.​ Development Tools:
o​ Android Studio is the official Integrated Development
Environment (IDE) for Android development, offering tools for
coding, testing, and debugging Android apps. Other essential tools
include:
▪​ Android SDK (Software Development Kit): Includes the
necessary libraries, tools, and documentation for developing
Android apps.
▪​ Emulator: A virtual Android device for testing apps on
different configurations and versions without needing
physical hardware.
8.​ Android APIs and Libraries:
o​ The platform offers a rich set of APIs and libraries for various
functionalities, including UI design, media handling, graphics,
networking, and more. Google also provides additional libraries
through Jetpack, a suite of libraries for Android development.
9.​ Hardware and Devices:
o​ The Android platform supports a wide range of hardware
configurations, from low-end to high-end devices, across multiple
manufacturers. This includes smartphones, tablets, wearables (like
smartwatches), smart TVs, automotive systems, and even
appliances.
10.​Android Ecosystem:
o​ Beyond the technical components, the Android platform includes a
vast ecosystem of developers, manufacturers, and users. This
ecosystem supports a thriving app market and encourages
innovation across a wide array of device types and industries.
Importance of the Android Platform
●​ Wide Adoption: Android powers billions of devices worldwide, making
it one of the most widely used mobile platforms.
●​ Flexibility and Customization: The platform's open nature allows for
extensive customization and flexibility, enabling device manufacturers
and developers to create unique user experiences.
●​ Support for Emerging Technologies: Android continues to evolve,
supporting new technologies like augmented reality (AR), machine
learning (ML), and the Internet of Things (IoT).
Anatomy of Andriod Application
The anatomy of an Android application consists of several key
components and files that work together to create a functioning app.
Here’s an overview:
1. Manifest File (AndroidManifest.xml)
●​ The manifest file is essential for every Android application. It declares
the app's components, permissions, and metadata. Key elements include:
o​ <application>: Specifies the application settings and components.
o​ <activity>: Declares an activity that is a single screen with a user
interface.
o​ <service>: Defines a background service.
o​ <receiver>: Registers a broadcast receiver.
o​ <provider>: Declares a content provider.
2. Java/Kotlin Files
●​ These files contain the source code for the app's functionality, typically
organized into different components like activities, services, and
broadcast receivers. For example:
o​ Activities: Each activity represents a single screen in the app.
o​ Services: Background processes that can run independently of
activities.
o​ Broadcast Receivers: Components that respond to system-wide
broadcast announcements.
o​ Content Providers: Manage access to structured data.
3. Layout XML Files
●​ These define the user interface for each screen or component. They are
stored in the res/layout directory and can include elements like:
o​ TextViews: Display text to the user.
o​ Buttons: Perform actions when clicked.
o​ EditTexts: Allow user input.
o​ ImageViews: Display images.
4. Resources (res)
●​ Drawable: Images and graphics, such as icons, stored in res/drawable.
●​ Values: XML files defining colors, strings, dimensions, and styles in
res/values.
●​ Menus: XML files for menu layouts in res/menu.
●​ Raw: Arbitrary raw assets, like audio files, stored in res/raw.
5. Gradle Scripts
●​ These scripts are used to build and manage the project. Key files include:
o​ build.gradle (Project-level): Configures project-level settings.
o​ build.gradle (Module-level): Configures specific module settings,
dependencies, and build types.
6. Assets
●​ The assets folder contains raw files (like text files or fonts) that you can
access programmatically.
7. APK and AAB Files
●​ APK (Android Package): The file format used to distribute and install
apps on Android devices.
●​ AAB (Android App Bundle): A new format that includes all compiled
code and resources but defers APK generation and signing to Google
Play.
8. Data and Storage
●​ Shared Preferences: Store private primitive data in key-value pairs.
●​ Internal/External Storage: Store files within the app's private storage or
the device's shared external storage.
●​ SQLite Databases: Store structured data in private databases.
These components work together to create a fully functioning Android
application, from defining the app's UI and behavior to handling data
storage and interaction with the Android system.
What is API level?
API Level is an integer value that uniquely identifies the framework API
revision offered by a version of the Android platform. For eg.

API
Platform Version VERSION_CODE
Level

Android 6.0 23 MARSHMALLOW

Android 5.1 22 LOLLIPOP_MR1

Android 5.0 21 LOLLIPOP

Android 4.4W 20 KITKAT_WATCH

Android 4.4 19 KITKAT

Android 4.3 18 JELLY_BEAN_MR2

Android 4.2, 4.2.2 17 JELLY_BEAN_MR1

Android 4.1, 4.1.1 16 JELLY_BEAN

Android 4.0.3, ICE_CREAM_SANDWICH_MR


15
4.0.4 1

Android 4.0, 4.0.1,


14 ICE_CREAM_SANDWICH
4.0.2

Android 3.2 13 HONEYCOMB_MR2

Android 3.1.x 12 HONEYCOMB_MR1


Android 3.0.x 11 HONEYCOMB

Android 2.3.4
10 GINGERBREAD_MR1
Android 2.3.3

Android 2.3.2
Android 2.3.1 9 GINGERBREAD
Android 2.3

Android 2.2.x 8 FROYO

Android 2.1.x 7 ECLAIR_MR1

Android 2.0.1 6 ECLAIR_0_1

Android 2.0 5 ECLAIR

Android 1.6 4 DONUT

Android 1.5 3 CUPCAKE

Android 1.1 2 Android 1.0


Android SDK

Android SDK stands for Android Software Development Kit which is developed by Google for
Android Platform. With the help of Android SDK, we can create android Apps easily.

Android SDK is a collection of libraries and Software Development tools that are essential for
Developing Android Applications.

Components of Android SDK

1.​Android SDK Tools


Android SDK tool is an important component of Android SDK. It consists of a complete set of
development and debugging tools. Below are the SDK developer tools:

●​ Android SDK Build tool.

●​ Android Emulator.

●​ Android SDK Platform-tools.

●​ Android SDK Tools.

Android SDK Build-Tools


●​ Android SDK build tools are used for building actual binaries of
Android App. The main functions of Android SDK Build tools are
built, debug, run and test Android applications. The latest version of
the Android SDK Build tool is 30.0.3. While downloading or
updating Android in our System, one must ensure that its latest
version is download in SDK Components.
Android Emulator
An Android Emulator is a device that simulates an Android device on your
system. In Android Emulator the virtual android device is shown on our
system on which we run the Android application that we code.

Android SDK Platform-tools

Android SDK Platform-tools is helpful when we are working on Project


and they will show the error messages at the same time. It is specifically
used for testing.
Android SDK Tools
Android SDK tool is a component of SDK tool. It consists of a set of tools
which and other Utilities which are crucial for the development of Android
Application. It contains the complete set of Debugging and Development
tools for android.
2.​ SDK Platforms
For Each Android Software, one SDK platform is available as shown
below:

Like in this Android 11.0(R) is installed.


These are numbered according to the android version. The new version of
the SDK platform has more features and more compatible but the old
version is less compatible with fewer features. Like in Android 11.0(R)
have more compatible and have more feature but the below versions like
Android 10.0(Q), Android4.4(KitKat) have less feature and is less
compatible
3.​ SDK Update Sites
In SDK Update Sites, some sites are embedded in it which will check for
Android SDK Updates Tools. In this, one must ensure we don’t unclick the
button below because these are checked by default which will check for
updates if we will unclick it then it doesn’t check updates for those.
●​
Jetpack Compose

Jetpack Compose is Android’s recommended modern toolkit for building


native UI. It simplifies and accelerates UI development on Android.
Quickly bring your app to life with less code, powerful tools, and
intuitive Kotlin APIs.
A simple composable function
Using Compose, you can build your user interface by defining a set
of composable functions that take in data and emit UI elements. A simple
example is a Greeting widget, which takes in a String and emits
a Text widget which displays a greeting message.

Figure 1. A simple composable function that is passed data and uses it to


render a text widget on the screen.
A few noteworthy things about this function:
●​ The function is annotated (add notes to (a text or diagram) giving
explanation or comment.)with the @Composable annotation. All
Composable functions must have this annotation; this annotation informs
the Compose compiler that this function is intended to convert data into
UI.
●​ The function takes in data. Composable functions can accept parameters,
which allow the app logic to describe the UI. In this case, our widget
accepts a String so it can greet the user by name.
●​ The function displays text in the UI. It does so by calling
the Text() composable function, which actually creates the text UI
element. Composable functions emit UI hierarchy by calling other
composable functions.
●​ The function doesn't return anything. Compose functions that emit UI do
not need to return anything, because they describe the desired screen state
instead of constructing UI widgets.
Android Manifest File
The Android Manifest file (AndroidManifest.xml) is a crucial component of any
Android application. It provides essential information to the Android system
about the app. Here’s an overview of its key elements and attributes:
Structure of the Android Manifest File
The AndroidManifest.xml file is located at the root of the project directory and
typically contains the following elements:
1.​ <manifest>: The root element of the file. It includes the package attribute
that defines the package name of the application.
2.​ <application>: Contains sub-elements that define the application
components such as activities, services, broadcast receivers, and content
providers.
3.​ <activity>: Declares an activity, a single screen with a user interface.
4.​ <service>: Declares a service, a component that performs operations in
the background.
5.​ <receiver>: Declares a broadcast receiver, a component that responds to
system-wide broadcast announcements.
6.​ <provider>: Declares a content provider, a component that manages
access to a structured set of data.
Common Attributes
●​ android:versionCode: An integer value that represents the version of the
application code, relative to other versions.
●​ android:versionName: A string value that represents the release version
of the application code, as it should be shown to users.
●​ android:icon: Specifies the icon for the application.
●​ android:label: Specifies a user-readable label for the application.
Example of an Android Manifest File
xml
Copy code
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp"
android:versionCode="1"
android:versionName="1.0">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Explanation of the Example
●​ <manifest>: Defines the package name com.example.myapp and sets
version information.
●​ <application>: Sets attributes like icon, label, and theme for the
application.
●​ <activity>: Declares an activity named MainActivity.
o​ <intent-filter>: Specifies that MainActivity should be the main
entry point (MAIN action) and should appear in the launcher
(LAUNCHER category).
Usage
●​ Manifest file configuration: Ensures the Android system is aware of the
components and capabilities of the application.
●​ Activity Declaration: Ensures the activity can be launched and appears
in the app launcher.
●​ Permissions: Inform the user what permissions the app requires and
ensures the app has the necessary permissions to function.
Jetpack and Jetpack Compose

Jetpack and Jetpack Compose are related but distinct components in the
Android development ecosystem. Here's a breakdown of the differences:
Jetpack
Definition:
Jetpack is a suite of libraries, tools, and architectural guidance provided by
Google to help developers build robust, high-quality Android apps. It
encompasses a wide range of components that address common development
challenges.
Components:
Jetpack libraries cover various aspects of app development, such as:
UI Components: RecyclerView, Navigation, etc.
Architecture Components: ViewModel, LiveData, Room, DataBinding,
WorkManager, etc.
Behavior Components: Notifications, Permissions, Preferences, etc.
Foundation Components: AppCompat, Android KTX, etc.
Purpose:
To simplify complex tasks, reduce boilerplate code, and provide best
practices to create scalable and maintainable apps.
To ensure backward compatibility and reduce the need for developers to
handle different Android versions.
Jetpack Compose
Definition:
Jetpack Compose is a modern UI toolkit included within the Jetpack suite. It
provides a declarative approach to building user interfaces on Android,
inspired by frameworks like React and SwiftUI.
Features:
Declarative UI: Instead of imperatively updating the UI, you describe the
UI in terms of functions that convert data into UI components. This leads to
more intuitive and less error-prone UI development.
State Management: Compose manages UI state efficiently and updates only
the necessary parts of the UI when the state changes.
Integration: Works seamlessly with other Jetpack libraries and the Android
framework.
Tooling: Integrated with Android Studio for real-time previews, animations,
and interactive tools.
Purpose:
To simplify UI development with a more intuitive, less verbose, and more
flexible approach.
To provide a more efficient and responsive UI framework that makes it
easier to handle complex UI interactions and animations.
Difference between APK and Google play store
The Android APK and the Google Play Store serve different purposes in the
Android ecosystem but are closely related. Here’s a detailed comparison of
the two:
Android APK
Definition:
An APK (Android Package Kit) is the file format used by the Android
operating system for the distribution and installation of mobile apps.
Purpose:
It contains all the elements that an app needs to install correctly on an
Android device, including the app’s compiled code, resources, assets, and
manifest file.
Distribution:
APK files can be distributed in various ways:
Official app stores: Such as the Google Play Store.
Third-party app stores: Like Amazon Appstore, APKPure, etc.
Direct download: Users can download APK files from websites and install
them manually (a process known as side-loading).
Installation:
Users can install APK files directly on their Android devices, usually by
downloading the file and opening it.
Installation from unknown sources requires enabling a specific setting in the
device’s security settings to allow installations from sources other than the
Google Play Store.
Usage:
APK files are used by developers to distribute beta versions, custom
versions, or apps not available on the Google Play Store.
Users who want to access apps not available in their region or want to try an
app version before it’s released officially might use APK files.
Google Play Store
Definition:
The Google Play Store is an official app store for Android devices, operated
by Google.
Purpose:
It serves as a centralized platform where users can browse, download, and
update Android apps and games.
The Play Store also offers other digital content such as movies, books,
music, and more.
Distribution:
Developers upload their apps to the Google Play Console, where they
undergo review before being published on the Play Store.
The Play Store provides a safe and controlled environment for users to
download apps.
Installation:
Users can easily install apps by browsing or searching for them in the Play
Store and clicking the install button.
The Play Store handles downloading and installing the app automatically.
Usage:
The Play Store provides automatic updates for installed apps, ensuring users
have the latest versions and security patches.
It also offers features like app reviews, ratings, recommendations, and
purchase management.
Gradle: Gradle is a powerful build automation tool used in Android Studio to
manage project dependencies, automate the build process, and streamline the
development workflow.
Each Android project contains a build.gradle file at the project level and
another build.gradle file for each module (app, library).
The project-level build.gradle file typically contains configurations for the
entire project, such as repositories and classpath dependencies.
The module-level build.gradle files define dependencies and build
configurations specific to that module.

androidTest Folder:
Used for instrumented tests.
Requires an Android device or emulator.
Useful for UI tests, integration tests, and end-to-end tests.

test Folder:
Used for local unit tests.
Runs on the local JVM.
Useful for testing business logic and other non-UI components.

mipmap directory is used for storing app icons. Unlike the drawable
directory, which is used for other graphical resources.

Logcat is a command-line tool and a key component in Android Studio


used for viewing system messages, including stack traces when an error
occurs, messages from the Log class in your code, and messages from
various applications and services running on the device. It is essential for
debugging and monitoring the behavior of your app during development.

Quality Insight in Android Studio refers to tools and features designed


to help developers improve the quality of their Android applications. These
tools provide insights into various aspects of the app's performance, security,
usability, and maintainability.

The Terminal in Android Studio is a powerful tool that provides a


command-line interface within the IDE, allowing developers to perform a
wide range of tasks without leaving the development environment.

You might also like