Chapter 1 Introduction to android.ppt pl

ENBAKOMZAWUGA 225 views 39 slides May 10, 2024
Slide 1
Slide 1 of 39
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39

About This Presentation

android


Slide Content

Introduction to Android
Asfaw k.
1

Outline
•What is Android?
•Introduction (The Android Stack)
•Android Architecture
•Application Components
•Android Development Process
2

What is Android?
•Android is a software stack for mobile devices
that includes an operating system,
middleware(Software that act as a bridge
between an operating system or database) and
key applications.
•Android is a mobile operating system that is
based on a modified version of Linux.
3

•Android is a comprehensive open source
platform designed for mobile devices.
•Comprehensive platform: complete
stack for mobile devices.
•Open source: the entire stacks are free to
•Google’s mobile platform
Runs Smartphone ,tablet computers , (Samsung
Tablets , Similar to iPad)
Most popular
• Development platform
Multiplatform
Based on Java
Plugins for Eclipse, Android Studio
4
cont.…

cont.…
•Android is an embedded OS(different kind of
machine or HW+SW)
•Android applications are written using
the Java framework, but Android is
not Java. Standard Java libraries such as
Swing are not supported.
•Android uses its own libraries.eg Time
Picker, global positioning.
•The Android OS is open source, which
means developers can view and use any
of the system source code
5

Android Features
•Storage: Uses SQLite, a lightweight relational database,
for data storage.
•Connectivity: Supports GSM/EDGE, IDEN, CDMA,
EV-DO, UMTS, Bluetooth (includes A2DP and AVRCP),
AVRCP), WiFi, LTE, and WiMAX.
•Messaging:Supports both SMS and MMS.
•Web browser: Based on the open-source WebKit,
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-
MPEG-4 SP, AMR, AMR-WB (in 3GP container), AAC,
HE-AAC (in MP4 or 3GP container), MP3, MIDI, Ogg
Vorbis, WAV, JPEG, PNG, GIF, and BMP
6

cont.…
•Hardware support: Accelerometer
Sensor, Camera, Digital Compass,
Proximity Sensor, and GPS
•Multi-touch:Supports multi-touch
screens
•Multi-tasking: Supports multi-tasking
applications
•Flash support: Android 2.3 supports
Flash 10.1.
•Tethering: Supports sharing of Internet
connections as a wired/wireless hotspot
7

Android Stack
•Android operating system is like a cake
consisting of various layers. Each layer has its
own characteristics and purposes.
•Android is built on top of Linux.
•Way Linux?
–Its open source
–Portability-easy to integrate with different
hardware
–Security-Linux is highly secured system.
–Features-Linux provides:
•Hardware abstraction layer
•Memory management
•Process management
•Networking
8


•Software stack for mobile
devices
•Developed and managed
by open handset Alliances
•Open sourced under
Apache License
9

Android Architecture

Android Architecture –Linux Kernel
•AndroidreliesonLinuxKernel2.6forcoresystemservices
»Processmanagement
»Network stack
»Driver model
»Security
•The Kernel acts as an abstrac5on layer between the hardware
and the rest of the software stack

Android Architecture -‐ Runtime
•Core Libraries
–Providesmostofthefunctionality
availableinthecorelibrariesofthe
Javaprogramminglanguage
–APIs
•Data Structures
•Utli5es
•File Access
•Network Access
•Graphics
•Etc
12

Android Architecture -‐ Runtime…
•Dalvik VM
–Every android application
runs in its own process with
its own instances of the
dalvik vm
–Dalvik VM has been writte
n so that a device can run
multipleVMs
efficiently
–Register‐based virtual machi
ne
13

Android Architecture -‐ Runtime…
•Executes files in the Dalvik Executable (.dex) format, which
is optimized for minimal memory footprint
•Runs classes compiled by a Java language compiler
transformed into the .dexformat

Relies on the Linux kernel for underlying functionality such as threa
ding and low-‐level memory management
14

Android Architecture -‐ Runtime…
•IncludesasetofC/C++
librariesusedbyvarious
componentsoftheAndroi
d
system
•Exposedtodevelopers
throughtheAndroid
applica5on framework
15
•Features
•System C Library (Bionic) a
version of libc : for technology and
license purpose
•Media Libraries supporting playbac
k and recording of popular audio/vi
deo formats
•Surface Manager (Surface Flinger)
•Audio Manager (Audio Flinger)
•LibWebCore (WebKit)
•SGL
•3D Libraries: Open GL ES
•WebKit browser support
•SQLite

Android Architecture -Application Frame work
•Enabling and simplifying the reuse of com
ponents
–Developers have full access to the same frame
work APIs used by the core applications.
–Application architecture designed to simplify re
use of components
–Users are allowed to replace components.
16

Android Architecture -Application Frame work…
•Set of service and features
17

Android Architecture -Applications
•Android ships with a set of core applications:
–Email Client
–SMS Program
–Calendar
–Maps
–Browser
–Contacts
•All applications are written using the Java language
18

Most Popular Android Version September 2018
19
Old Version: Android 1.0, 1.1 to 1.5 (Cupcake), 1.6 (Donut), 2.0/2.1 (Eclair), 2.2
(Froyo), 2.3 (Gingerbread), to 3.0 (Honeycomb), 4.0 (Ice Cream Sandwich

Android Applications
•Android applications are written in Java
•The compiled Java code (along with any
data and resourcefilesrequired by the applicat
ion) is bundled into an Android package (.ap
k)
20
Runs in its own
Linux process
Each process has its own
virtual machine
Each application assigned
a unique Linux user Id

What is APK?
•An application is a single application package (APK) file.
An APK file roughly has three main components. An API
consists of the following major components:
•Dalvik executable
–This is all your Java source code compiled down to a Dalvik
executable.
–This is the code that runs your application.
•Resources
–Resources are everything that is not code. Your application may
contain a number of images and audio/video clips, as well
as numerous XML files describing layouts, language
packs, and so on. Collectively, these items are the
resources.
•Native libraries
–Optionally, your application may include some native code, such as
C/C++ libraries. These libraries could be packaged
21

Androidand Java
•Android Java
=
Java SE

AWT/Swing
+
Android API
22
Still We can have it the old Classic Way (Procedural )
But This is a better approach( separating content from display)

AndroidandJava
•Android java is an nonstandard collection of java. way?
•java have different Editions (Java Packaging)
–Java ME (Mobile Edition)
–java SE(Standard Edition )
–Java EE(Enterprise Edition)
•but android is not part of these editions
•So why Java ::: market issue because tons of java coders in
the world
23

Basic Application Components
24

Activity
•An activity is usually a single screen that the
user sees on the device at one time.
undertake:
–Extends the Activitybase class
–Displays user interface controls (views)
–Provides for user interaction
25

Service
•service runs in the background for an indefinite
period of time.
–Example: play music, network download, etc.
–Does not have a user interface
–extends the Servicebase class.
•We can bind to a running service (or start the service if it's
not already running)
26

Broadcast Receivers
•Receives and reacts to broadcast announcements (Intents)
–Many broadcasts originate in system code.
–E.g. announcements that a picture is taken,that the time z
one has changed, that the battery is low, etc.
–Applications can also initiate ate broadcasts.
•E.g. to let other applications know that some data has
been downloaded to the device and is available for the
m to use
•Do not have a user interface
•May start an activity in response to the received
broadcast.
•May also use notificationsto alert the user.
27

ContentProviders
•Makes a specific set of the applications
data available to other applications.
–Data can be stored in the file system, in an
SQLite, or in any other manner that makes sense
–extends the ContentProvider base class to implement a
standard set of methods that enable other applica5ons
to retrieve and store
data of the type it controls
•Applications do not call these methods directly.
–They use a ContentResolverobject and call its method
s instead
–ContentResolvercan talk to any content provider
28

Installing and Configuring development Tools
•Android Studio: An easy to use Integrated
Development Environment (IDE) that brings
together Java and the Android SDK to make it
simple to write Android apps.
•Java JDK: The Java Development Kit. Lays
the foundation for the Android SDK.
•Android SDK: Included in Android Studio.
–Provides access to Android libraries and allows
you to develop for Android.
29

Installing Android Studio
•To download Android Studio,
•https://developer.android.com/studio
30

Adding SDK Packages
•1. Choose Tools⇒Android⇒SDK Manager to launch the SDK
manager tool.

31

Setting Up an Emulator
•Like a real android device and allow you to test your application without having a
real device.
1.Choose Tools⇒Android⇒AVD Manager.
The AVD Manager dialog box opens.
32

33

34

Understanding Project Structure
35
•app: Where your main app code is placed.
•build.gradle: Your top level build file. It tells gradle, the
Android build system, how to build the various subdirectories
in your project.

app directory
36

•What the Android manifest file contains
–The name of your application ID for the
application, which is the unique identifier for your
application in the Android system as well as in the
Google Play Store
–The icon for your application
–The components of the application, such as the
activities and ​background services
–The declaration of the permissions your
application requires to run
37

Viewing the build.gradle file
38
The compileSdkVersiontells Android Studio what version of the Android SDK you are
compiling against. This version is set based off the choices you made when you went
through the New Activity Wizard ​earlier in this chapter.
The buildToolsVersiontells Android Studio what version of the build tools to use
(which is the version of the tools that you installed on your computer).
The applicationIdmust match the package that you set in your AndroidManifest.xml
file.

Lab session
What you'll learn
•How to create a project in Android Studio.
•How to create an emulated Android device.
•How to run your app on the emulator.
•How to run your app on your own physical
device, if you have one.
39