Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Module 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 115

Module 1

Introduction of Android
By: Mitul Patel
Outline
• Introduction to Subject
• What is Android?
• What is “Open Handset Alliance”?
• Why Android?
• Android Version
• Features of Android
• Architecture of Android
Introduction to Subject
Syllabus Book
https://ppsu.ac.in/soe/downloads/AY202122_Syllabus%20Book_CE.pdf
Course Content
Books
What is Mobile Application Development?

• Mobile application development is the set of processes and


procedures involved in writing software for small, wireless
computing devices, such as smartphones and other hand-held
devices.
Types of Mobile Apps by Technology

• There are three basic types of mobile apps if we categorize them by


the technology used to code them:
• Native apps are created for one specific platform or operating
system.
• Web apps are responsive versions of websites that can work on any
mobile device or OS because they’re delivered using a mobile
browser.
• Hybrid apps are combinations of both native and web apps, but
wrapped within a native app, giving it the ability to have its own icon
or be downloaded from an app store.
Native Apps
Web Apps
Hybrid Apps
What is Android?
• Android is a Linux based mobile operating system.
• Initially Android was available for mobile devices only.
• Later on android is also available for tablets,ware, big
screen(TV), automobile etc.
• Android was unveiled during 2007 along with the
founding of the Open Handset Alliance
What is “Open Handset Alliance”?
• Open Handset Alliance(OHA) was formed in November 2007.
• The OHA is the group that is in charge of the Android
Smartphone Operating System. It was created by Google.
• The OHA is a business alliance that consists of 47 companies
for developing open standard platform for mobile devices.
• The members of OHA includes handset manufactures, chip
makers, commercialization companies, software companies
and mobile operators.
OHA
Why Android ?
• Android applications are usually developed in the
Java language using the Android Software
Development Kit.
• Once developed, Android applications can be
packaged easily and sold out either through a
store such as Google Play, SlideME, Opera
Mobile Store, Mobango, F-droid and the Amazon
Appstore.
• Android powers hundreds of millions of mobile
devices in more than 190 countries around the
world. It's the largest installed base of any mobile
platform and growing fast.
• Every day more than 1 million new Android
devices are activated worldwide.
Features of Android
1. Open Source: the original source code of android is available
for modifications.
2. Android OS is device independent.
3. Android OS supports NFC(Near Field Communication)
– Transfer any amount of data by simply touching the two devices.
– Maintain less than 1 cm distance in between two devices.
4. Android OS supports IPC(Inter Process Communication)
5. By default Android OS is available with SQLite.
– This database is open source & supports RDBMS
Features of Android
6. Android OS supports for SSL(Secure Socket Layer)
– TLS(Transport Layer Security)
– In SSL client & server interaction done in encrypted mode.
7. Android OS will support Text to Speech and Speech to Text
conversion.
8. Android device can be controlled through voice commands.
9. Android supports all types of images, audio, video,different
types of languages, different types of fonts.
Features of Android
10. Android OS supports basic graphics and 2-D,3-D animation.
11. Supports Video calling.
12. External storage
– Most Android devices include microSD slot and can read microSD
cards formatted with FAT32,Ext3 or Ext4 file system.
Developer

• Android OS is designed and developed by Andi


Rubin.
• Handover to the Google in Corporation in the
year of 2007.
Android Versions
Version Nickname Release Date
1.0 Android September 23,2008
1.1 Beta Android February 9,2009
1.5 Cupcake April 27,2009
1.6 Donut September 15,2009
Android 1.x Mobiles only
Android Éclair October 26,2009
2.0/2.1
2.2 – 2.2.3 Froyo May 20,2009
2.3 – 2.3.7 Gingerbred December 6,2010
Android 2.x is also designed for mobiles but from 2.x android started supporting API.
- By using Google API android application can interact with Google products such as Gmail, YouTube, google
maps,
navigation, google search engine, google Clouds
Android Versions
Version Nickname Release Date
Android 3.0 – 3.2.6 Honey Comb February 22,2011
Android 3.x is specially designed for tablets. Started supporting Fragments.
Android 4.0 – 4.0.4 Ice-cream Sandwich October 18,2011
4.1 – 4.3.1 Jellybean July 9,2012
4.4 – 4.4.4 KitKat October 31,2013
4.4.w supports for wearable devices like wrist-watch. From 4.x android started supporting mobiles & tablets
application. It means single app can run in mobiles & tablets
Android Versions
Version Nickname Release Date
Version Nickname Release Date
5.0 – 5.1.1 Lollypop November 12,2014
Android 5.x designed for Big Screens ie. TV
Android 6.0 – 6.0.1 Marshmallow October 5,2015
Android 6.0 designed for Automobiles(speed of car, km)
Android 7.0 – 7.1.2 Nougat August 22,2016
8.0 – 8.1 Oreo August 21,2017
9.0 Pie August 6,2018
10.0 September 3,2019
11.0 September 8,2020
12.0 October 19, 2021
ANDROID Version History
Android 1.0 to 1.1(September 23, 2008)

Features:
•Google Maps.
•Camera.
•Gmail, Contacts, and Google
Synchronization.
•Web Browser.
•Wireless supports – Wi-Fi
and Bluetooth.
Beta 1.1(February 9, 2009)
• released on February 9, 2009.
• Features:
– Add Save attachment in the message.
– Provides reviews and details when the user search business on
maps.
Android version 1.5: Cupcake
April 30, 2009

Features:
•New upload service on YouTube and Picasa
like Uploading Videos and Photos.
•Supporting in MPEG-4, Video recording.
•Improving Web Browser-Copy and Paste
facility.
Android version 1.6: Donut
September 15, 2009.

Features:
•The main enhancement was a Power
Control widget for managing Wi-Fi,
Bluetooth, GPS, etc.
•Provided Gallery and Camera features with
quick toggling features.
•Improve the speed in system apps.
•Introduction of the Quick Search Box.
Android versions 2.0 to 2.1: Eclair
December 3, 2009.

Features:
•Update UI.
•Support Live Wallpaper.
•Support Bluetooth 2.1.
•Improve Google map.
•Minor API Changes.
Android version 2.2: Froyo
May 20, 2010.

Features:
•Support for Animated GIF.
•Wi-Fi Support Hotspot functionality.
•Speed improvements.
•Upload file support in the browser.
•Support numeric and alphanumeric
passwords.
Android version 2.3: Gingerbread
December 6, 2010
Features:
•Improve Copy-Paste Facility.
•Updated UI design.
•VP8 and WebM video format support.
•Social Networking Supports.
•Easy use of the keyboard.
•Multiple camera support (usually known as a
selfie camera nowadays).
Android 3.0/3.1/3.2 – Honeycomb

Features:
•Gmail App improvements.
•Updated 3D UI.
•Supports multiprocessors and hardware
acceleration for graphics.
•Media Sync from SD Card.
•Google eBooks.
•Google Talk Video Chat.
•Support Adobe Flash in Browser.
•High-performance Wi-Fi Connections and
Lock.
•Chinese handwriting.
Android version 4.0: Ice Cream Sandwich
October 19, 2011
Features:
•Improved text input and spelling check.
•Wi-Fi direct (Sharing information using
NFC).
•Photo Decor facility.
•Improved keyboard correction.
•Unlocking with face-fixing.
•Improved video recording resolution.
•Camera performance.
•Up to 16 tabs in the web browser.
Android versions 4.1 to 4.3: Jelly Bean
Features:
•Voice search.
•Panorama.
•Daydream as a screensaver.
•Power control.
•Improve camera application.
•Security enhancement.
•Voice typing.
•Multiple user accounts on tablets only.
•4k resolution support.
•Supporting Bluetooth Low Energy.
•Bi-directional text and other language support.
•Support USB audio.
•Set the volume of incoming calls and show a
message alert.
•Native emoji support.
Android version 4.4: KitKat
September 3, 2013.
Features:
•Screen Recording.
•KitKat adds a feature in ‘Google now’. Its
name is ‘OK Google’. “OK, Google” allows
access to Google to the users without
touching your mobile phone.
•GPS Support.
•Offline music support.
•UI updates for google map navigation and
alarm.
•Introduction of ‘Emoji’ to the google
keyboard.
Android versions 5.0 and 5.1: Lollipop
November 12, 2014
Features:
•Support ART( Android Runtime).
•Improvement in UI.
•New material design.
•Notifications on the Lock screen.
•Revamped navigation bar.
•Multiple sim card support.
•High definition voice call.
Android version 6.0: Marshmallow

Features:
•Fingerprint authentication to
unlock the screen.
•USB Type C support.
•Multi-window experiments
(user can use two different
apps in one screen).
•Save battery-’Sleep Mode’.
•App permission model-
OPT(send a request for
permission).
Android versions 7.0 and 7.1: Nougat
March 2016 Features:
•Provide multitasking.
•Inline reply to messages and
notifications so you won’t have to
open up your Messenger
application for quick replies.
•Providing multi-window mode.
•Improvements in storage
manager.
•Display touch improvement.
Android version 8.0 and 8.1: Oreo

Features:
•Support PIP(Picture-in-Picture).
•Multi-display support.
•Google Play support.
•Adaptive icons.
•Revamped notification section(Users can set which
notifications you want to show).
Android version 9: Pie
August 2018.
Features:
•New Gesture Navigation.
•Artificial intelligence (AI) Compatible.
•Adaptive Battery and Brightness.
•App Actions.
•New Screenshot Shortcuts.
•Easier Screen Rotation.
•Volume and Sound Improvement.
•Selectable Dark Mode.
•Slices.
•Improved Security Features.
•Digital Wellbeing.
•New Accessibility Menu.
•Easier Text Selection.
•More Notification Information.
Android version 10: Android Q
September 3, 2019
Features:
•Support for the upcoming foldable
smartphones with flexible displays which is
an upcoming rush.
•System-wide dark mode.
•Navigation control over gesture.
•Smart reply for all messaging apps.
•Support for Live caption.
•Better notification control.
Android version 11 (Developer Preview)
preview on February 19 of year 2021.
• Features (announced):
– New Support for 5G.
– Privacy and Security; A new privacy choice for apps is the “Only This
Time” option when you’re allowing the app access to your location,
microphone, or camera.
– Support new screen types (pinhole and waterfall).
– Low Latency Options; adds low latency support in new MediaCodec
APIs and HDMI which is very useful for use on external displays and
TVs.
SUPPORTING DEVICES
Mobile Phones
ANDROID TABLETS
SMARTWATCHES
SMART TVs
SMART GLASSES
HOME APPLIANCES
Android Architecture
• Android is a mobile platform which consists three things:
– Android OS
– Middleware
– Key Applications
Android Architecture
• Android OS is a software stack of different layers, where each
layer is a group of several program components.
• Android has the following layers:
1. Applications
2. Application Framework
3. Libraries
4. Android Runtime
5. Linux Kernel
Android Architecture
Applications

• Written using Java Language


– Email Client
– SMS Program
– Maps
– Browser
– Calendar
– Contacts
• Supports Parallel running
• No compulsory applications
Application Framework

• The Application Framework layer provides many higher-level


services to applications in the form of Java classes.
• Application developers are allowed to make use of these
services in their applications.
Application Framework
• The Android framework includes the following key services −
• Activity Manager − Controls all aspects of the application lifecycle and activity
stack.
• Content Providers − Allows applications to publish and share data with other
applications.
• Resource Manager − Provides access to non-code embedded resources such as
strings, color settings and user interface layouts.
• Notifications Manager − Allows applications to display alerts and notifications
to the user.
• View System − An extensible set of views used to create application user
interfaces.
Libraries

• Useful to develop any third-party application.


• Native libraries are written in a language that compiles to
native code for the platform it run.
Libraries
1. SQLite - Responsible for Database Operation
2. Free Type - Font Support
3. Media F/W - Audio,Video Format
4. Open GL(Open Google Library) - 2D,3D Graphics Support
5. SSL - Encrypted Communication between Client and Server
6. SGL (Scalable Graphics Libraries)- For Basic Graphics Support
Android Runtime

• Android Runtime consists of Core Libraries and Dalvik Virtual


Machine.
• Core Libraries are written in C/C++ languages. This libraries
are helpful for runtime environment. Some of the core
libraries are Data Structure, File Access, Network Access,
Utilities and Graphics.
DVM(Dalvik Virtual Machine)
• Runtime environment for running android application.
• JVM is used to run high-end applications while DVM is used
for small-end applications.
• DVM was first written by "Dan Bornstein“
• Unlike JVM, the DVM does not run .class files but it runs .dex
files.
• .dex files are built from .class file at the time of compilation
and provide higher efficiency in row resource environments.
Linux Kernel

• Linux Kernel is a Root layer of android Architecture which is


responsible for device drivers(display, camera, Bluetooth,
flash, web driver, usb, keypad,wifi etc.)
• power management, memory management and resource
management.
How Android Works?
Download and Install Android Studio
• Android Studio is the official integrated development
environment for Google’s Android operating system, built on
JetBrains’ IntelliJ IDEA software and designed specifically for
Android development.
Installation guide:
• Step – 1 :
Go to URL https://developer.android.com/studio to get the Android
Studio executable or zip file .
• Step – 2 : Click on the download android studio button
• Click on the “I have read and agree with the above terms and
conditions” checkbox followed by the download button.
• Step – 3:After the downloading has finished, open the file from
downloads and run it .
It will prompt the following dialogue box .
• Step – 4 :It will start the installation, and once it is completed,
it will be like the image shown below .
• Step – 5 :Once “Finish” is clicked, it will ask whether the
previous settings needs to be impoerted [if android studio had
been installed earlier], or not.
It is better to choose the ‘Don’t import Settings option’ .
• Step – 6 :This will start the Android Studio. Meanwhile it will be finding the
available SDK components .
• Step – 7:After it has found the SDK components, it will redirect
to the Welcome dialog box .
• Choose Standard and click on Next.
Now choose the theme, whether Light theme or the Dark one .
The light one is called the IntelliJ theme whereas the dark
theme is called Darcula .
Choose as required.
• Step – 8 :Now it is time to download the SDK components .
• It has started downloading the components
• Step – 9 :Click on ‘Start new android project’ to build a new
app.
Exploring Android SDK
• Android SDK is a software development kit developed by
Google for the Android platform.
• Android SDK comes bundled with Android Studio, Google's
official integrated development environment (IDE) for the
Android operating system
What Is the Android SDK?

• The Android SDK is a collection of software development tools and libraries


required to develop Android applications.
• Every time Google releases a new version of Android or an update, a
corresponding SDK is also released which developers must download and
install.
• The Android SDK comprises all the tools necessary to code programs from
scratch and even test them. These tools provide a smooth flow of the
development process from developing and debugging, through to
packaging.
• The Android SDK is compatible with Windows, macOS, and Linux, so you can
develop on any of those platforms.
Android SDK
How to Install the Android SDK?
• To install the Android SDK from within Android Studio, first
start Android Studio.
• From the Android Studio start page, select Configure > SDK
Manager.
• If you already have Android Studio open, the SDK Manager
icon is found on the top right corner, as shown below.
Components of the Android SDK
• The Android SDK consists of an emulator, development tools,
sample projects with source code, Google API, and the
required libraries to build Android applications
Android SDK Platform
• Provided in the android.jar file that made up of several
important packages.
Top-Level Package Name Description
android.* Android application fundamentals
dalvik.* Dalvik Virtual machine support fundamentals
java.* Core java classes and generic utilities for
networking, security, math and so on

javax.* Encryption support


junit.* Unit-Testing support
org.apache.http.* HTTP Protocol support
org.json JavaScript Object Notation Support
Android SDK Tools

• Android SDK provides many tools to design, develop, debug


and deploy your applications.
– Android Studio
– Android SDK and AVD Managers
– Android Emulator
Android SDK and AVD Managers
• Different Android Devices run different version of the Android
Operating System.
• Developers need to be able to target different Android SDK
versions with their applications.
• The Android Virtual Device Manager organizes and provides
tools to create and edit AVDs.
SDK Platform-Tools

• Android Platform-Tools are used to support the features for the current
Android platform and are necessary for Android app development.
• Android Debug Bridge (adb): This is a handy command-line tool that lets you
communicate with a device. The adb command allows you to perform
device actions, such as installing and debugging apps. It also provides access
to a Unix shell that you can use to run a variety of commands on a device.
• fastboot: This lets you flash a device with a new system image.
• systrace: This tool helps collect and inspect timing information across all
processes running on your device at the system level. It's crucial for
debugging app performance.
Android Emulator

• The Android Emulator is a device-emulation tool that


simulates Android devices on your computer, allowing
developers to test applications on different devices and
Android API levels, without needing to have physical devices
for each.
• The emulator comes with configurations for various Android
phones, tablets, Wear OS, and Android TV devices.
Android Emulator

• The Android emulator provides almost all of the capabilities of a


real Android device. You can perform the following activities:
• simulate phone calls and text messages
• simulate different network speeds
• specify the location of the device
• simulate hardware sensors such as rotation
• access Google Play Store and much more
• Often it is faster and easier to test your app with an emulator instead
of using a physical device.
Emulators vs Simulators
Android Terminologies
• XML
– In Android, XML is used for designing the application’s UI like creating layouts, views,
buttons, text fields etc. and also used in parsing data feeds from the internet.
• View
– A view is an UI which occupies rectangular area on the screen to draw and handle user
events.
• Layout
– Layout is the parent of view. It arranges all the views in a proper manner on the screen.
• Activity
– An activity can be referred as your device’s screen which you see. User can place UI
elements in any order in the created window of user’s choice.
– android.app.Activity class
Android Terminologies
• Emulator
– An emulator is an Android virtual device through which you can
select the target Android version or platform to run and test your
developed application.
• Manifest file
– Manifest file acts as a metadata for every application. This file
contains all the essential information about the application like app
icon, app name, launcher activity, and required permissions etc.
Android Terminologies
• Service
– long-running background processes w/o user interaction.
E.g. wifi availability, n/w changed, entering into roaming, playing music in background.
– It is not bounded with any activity as there is no UI. Any other application component can start a
service and this service will continue to run even when the user switches from one application to
another.
– android.app.service class
• Broadcast Receiver
– register for system and application events.
– It works in such a way that, when the event triggers for the first time all the registered receivers
through this broadcast receiver will get notified for all the events by Android Runtime.
E.g. charger connected, USB connected, Handsfree connected, power button pressed, Volume
Button increased/decreased
Android Terminologies
• Content Provider
– Shared data between multiple applications
– Sharing contacts information to WhatsApp
– Contacts, CallLog, Settings
Android Terminologies
• Fragment
– Used to hold the code and screen logic for placing the same user
interface components in multiple screens, which are represented by
multiple Activity classes.
– android.app.Fragment
• Intent
– Intent is a messaging object which can be used to communicate
between two or more components like activities, services, broadcast
receiver etc. Intent can also be used to start an activity or service or to
deliver a broadcast messages.
Android Terminologies
• Context:
– the current state of our application/object.
– To get information regarding another part of your program (activity
and package/application).
– The application wide Context object is instantiated as an Application
object(android.app.Application).
Toast
• Display information for the short period of time. A toast
contains message to be displayed quickly and disappears after
sometime.
• The android.widget.Toast class is the subclass of
java.lang.Object class.
Performing Application Tasks with Activities
• Activity class is the core of any Android Application.
• You define and implement Activity class for each screen in your
application.
• For example a simple game application might have the following
five activities:
– A starting screen: displays the application name and version
– A main menu screen: users choose what they want to do within the
application.
– A game play screen
– A high score screen
– A help/about screen
Android Activity
Android Activity Lifecycle methods
Method stubs of Activity class
public class MyActivity extends Activity
{
protected void onCreate(Bundle savedInstanceState);
protected void onStart();
protected void onRestart();
protected void onResume();
protected void onPause();
protected void onStop();
protected void onDestroy();
}
Activity Lifecycle
Managing Activity Transitions with Intents
• Launching the new Activity by Class Name (Explicit Intent)

Intent intent = new Intent(MainActivity.this,SecondActivity.class);


startActivity(intent);

• Launching an Activity Belonging to Another


Application(Implicit Intent)
Uri number = Uri.parse(“tel: 9998580268”);
Intent dial = new Intent(Intent.ACTION_DIAL,number);
startActivity(dial);
Android Services
• Android Services are the application components that run in
the background.
• We can understand it as a process that doesn’t need any direct
user interaction.
• As they perform long-running processes without user
intervention, they have no User Interface(connection to server).
• They can be connected to other components and do inter-
process communication (IPC).
• Services must be registered in the Android manifest file.
Android Services
1. A whether,email or social network app might implement a
service to routinely check for updates on the network.
2. A game might create a service to download and process the
content for the next level before the user actually needs it.
3. A news application might implement a service to “preload”
content by downloading news stories before the user
launches the application, to improve performance and
responsiveness.
Life Cycle of Android Service
• There can be two forms of a service.The lifecycle of service can follow two
different paths: started or bound.
1. Started
2. Bound
1) Started Service
• A service is started when component (like activity) calls startService() method,
now it runs in the background indefinitely. It is stopped by stopService() method.
The service can stop itself by calling the stopSelf() method.
2) Bound Service
• A service is bound when another component (e.g. client)
calls bindService() method. The client can unbind the service by calling
the unbindService() method.
Example
• Create a GUI Having two button StartService and StopService
Creating the custom service class
Working with the MainActivity file
• Calling startService() method for onClick() Listener of
startService Button.

• Calling stopService() method for onClick() Listener of


stopService Button.
Receiving and Broadcasting Intents
• You can broadcast an Intent(via a call to the sendBroadcast()
method of the Context class) to the Android system at
large,allowing any interested application(called a
BroadcastReceiver) to receive that broadcast and act upon it.
• Broadcasts are generally used to inform the system that
something interesting has happened.
• For example, a commonly listened-for broadcast Intent is
ACTION_BATTERY_LOW, which is broadcast as a warning
when the battery is low.
System-wide generated intents
Create a new BroadcastReceiver class
Working with the MainActivity file
Context in Android
• context of the current state of our application.
• We can break the context and its use into three major points:
• It allows us to access resources.
• It allows us to interact with other Android components by sending
messages.
• It gives you information about your app environment.
Context in Android
• current state of the application.
– Usually, the app got multiple screens like display/inquiry/add/delete screens. So
when the user is searching for something, the context is an inquiry screen in this
case.
• It can be used to get information regarding the activity and application.
– The inquiry screen’s context specifies that the user is in inquiry activity, and
he/she can submit queries related to the app
• It allows us to interact with other Android components by sending
messages.
• Both the Activity and Application classes extend the Context class.
Understanding Context by a Real World Example

• Let’s a person visit a hotel. He needs breakfast, lunch, and


dinner at a suitable time. Except for these things there are also
many other things, he wants to do during the time of stay. So
how does he get these things? He will ask the room-service
person to bring these things for him. Right? So here the room-
service person is the context considering you are the single
activity and the hotel to be your app, finally, the breakfast,
lunch & dinner have to be the resources.
Types of Context in Android
getApplicationContext()
• It is used to return the context which is linked
to the Application which holds all activities running inside
it. When we call a method or a constructor, we often have to
pass a context and often we use “this” to pass the activity
context or “getApplicationContext” to pass the application
context. This method is generally used for the application level
and can be used to refer to all the activities. For example, if we
want to access a variable throughout the android app, one has
to use it via getApplicationContext()
Activity Context
• It is the activity context meaning each and every screen got
an activity.
• For example, EnquiryActivity refers to EnquiryActivity only
and AddActivity refers to AddActivity only.
• The method of invoking the Activity Context is getContext().
• Some use cases of Activity Context are:
• The user is creating an object whose lifecycle is attached to an
activity.
• Whenever inside an activity for UI related kind of operations like
toast, dialogue, etc
Example

You might also like