Android_unit_1

INTRODUCTION TO Android Programming

  1.  What is Android?

Android is an open source and Linux-based Operating System for mobile devices such as smartphones and tablet computers. Android was developed by the Open Handset Alliance, led by Google, and other companies.

Android offers a unified approach to application development for mobile devices which means developers need only develop for Android, and their applications should be able to run on different devices powered by Android.

Features of Android

Features of Android

  • Android Open Source Project so we can customize the OS based on our requirements.
  • Android supports different types of connectivity for GSM, CDMA, Wi-Fi, Bluetooth, etc. for telephonic conversation or data transfer.
  • Using wifi technology we can pair with other devices while playing games or using other applications.
  • It contains multiple APIs to support location-tracking services such as GPS.
  • We can manage all data storage-related activities by using the file manager.
  • It contains a wide range of media supports like AVI, MKV, FLV, MPEG4, etc. to play or record a variety of audio/video.
  • It also supports different image formats like JPEG, PNG, GIF, BMP, MP3, etc.
  • It supports multimedia hardware control to perform playback or recording using a camera and microphone.
  • Android has an integrated open-source WebKit layout-based web browser to support User Interfaces like HTML5, and CSS3.
  • Android supports multi-tasking means we can run multiple applications at a time and can switch between them.
    1.  History and Versions

Android Versions

Code Name

Version

API level

Release date

Android 1.0

1

September 23,2008

Android 1.1

2

February 9,2009

Cupcake

Android 1.5

3

April 30,2009

Donut

Android 1.6

4

September 15,2009

Eclair

Android 2.0 – 2.1

5-7

October 26,2009

Froyo

Android 2.2 – 2.2.3

8

May 20,2010

Gingerbread

Android 2.3 – 2.3.4

9-10

December 6,2010

Honeycomb

Android 3.0.x – 3.2.x

11 – 13

February 22,2011

Ice Cream Sandwich

Android 4.0 – 4.0.4

14 – 15

October 18,2011

Jelly Bean

Android 4.1 – 4.1.2

16 – 18

July 9,2012

Kitkat

Android 4.4 – 4.4.4

19

July 9,2012

Lollipop

Android 5.0 – 5.1

21 – 22

October 17,2014

Marshmallow

Android 6.0 – 6.0.1

23

October 5,2015

Nougat

Android 7.0 – 7.1

24 – 25

August 22,2016

Oreo

Android 8.0

26

August 21,2017

Pie

Android 9.0

27

August 6,2018

Android Q

Android 10.0

29

September 3,2019

Android 11

Android 11.0

30

September 8,2020

Snow Cone

Android 12.0 – 12.1

31-32

October 4,2021

Tiramisu

Android 13

 

UPCOMING

 

  1.  Android Architecture

Lightbox

 

Applications –

Applications is the top layer of android architecture. The pre-installed applications like home, contacts, camera, gallery etc and third party applications downloaded from the play store like chat applications, games etc. will be installed on this layer only.
It runs within the Android run time with the help of the classes and services provided by the application framework.

Application framework –

Application Framework provides several important classes which are used to create an Android application. It provides a generic abstraction for hardware access and also helps in managing the user interface with application resources. Generally, it provides the services with the help of which we can create a particular class and make that class helpful for the Applications creation.

It includes different types of services activity manager, notification manager, view system, package manager etc. which are helpful for the development of our application according to the prerequisite.

Application runtime –

Android Runtime environment is one of the most important part of Android. It contains components like core libraries and the Dalvik virtual machine(DVM). Mainly, it provides the base for the application framework and powers our application with the help of the core libraries.

Like Java Virtual Machine (JVM), Dalvik Virtual Machine (DVM) is a register-based virtual machine and specially designed and optimized for android to ensure that a device can run multiple instances efficiently. It depends on the layer Linux kernel for threading and low-level memory management. The core libraries enable us to implement android applications using the standard JAVA or Kotlin programming languages.

 

Platform libraries –

The Platform Libraries includes various C/C++ core libraries and Java based libraries such as Media, Graphics, Surface Manager, OpenGL etc. to provide a support for android development.

  • Media library provides support to play and record an audio and video formats.
  • Surface manager responsible for managing access to the display subsystem.
  • SGL and OpenGL both cross-language, cross-platform application program interface (API) are used for 2D and 3D computer graphics.
  • SQLite provides database support and FreeType provides font support.
  • Web-Kit This open source web browser engine provides all the functionality to display web content and to simplify page loading.
  • SSL (Secure Sockets Layer) is security technology to establish an encrypted link between a web server and a web browser.

 

Linux Kernel –

Linux Kernel is heart of the android architecture. It manages all the available drivers such as display drivers, camera drivers, Bluetooth drivers, audio drivers, memory drivers, etc. which are required during the runtime.

The Linux Kernel will provide an abstraction layer between the device hardware and the other components of android architecture. It is responsible for management of memory, power, devices etc.

The features of Linux kernel are:

  • Security: The Linux kernel handles the security between the application and the system.
  • Memory Management: It efficiently handles the memory management thereby providing the freedom to develop our apps.
  • Process Management: It manages the process well, allocates resources to processes whenever they need them.
  • Network Stack: It effectively handles the network communication.
  • Driver Model: It ensures that the application works properly on the device and hardware manufacturers responsible for building their drivers into the Linux build.

 

  1.  Basic Building Blocks

There are some necessary building blocks that an Android application consists of. These loosely coupled components are bound by the application manifest file which contains the description of each component and how they interact. The manifest file also contains the app’s metadata, its hardware configuration, and platform requirements, external libraries, and required permissions. There are the following main components of an android app:

1. Activities

Activities are said to be the presentation layer of our applications. The UI of our application is built around one or more extensions of the Activity class. By using Fragments and Views, activities set the layout and display the output and also respond to the user’s actions. An activity is implemented as a subclass of class Activity. 

public class MainActivity extends Activity {

}

2. Services

Services are like invisible workers of our app. These components run at the backend, updating your data sources and Activities, triggering Notification, and also broadcast Intents. They also perform some tasks when applications are not active. A service can be used as a subclass of class Service: 

public class ServiceName extends Service {

}

3. Content Providers

It is used to manage and persist the application data also typically interacts with the SQL database. They are also responsible for sharing the data beyond the application boundaries. The Content Providers of a particular application can be configured to allow access from other applications.
A content provider should be a sub-class of the class ContentProvider.  

public class contentProviderName extends  ContentProvider {

   public void onCreate(){}

}

4. Broadcast Receivers

They are known to be intent listeners as they enable your application to listen to the Intents that satisfy the matching criteria specified by us. Broadcast Receivers make our application react to any received Intent thereby making them perfect for creating event-driven applications.

5. Intents

It is a powerful inter-application message-passing framework. They are extensively used throughout Android. Intents can be used to start and stop Activities and Services, to broadcast messages system-wide or to an explicit Activity, Service or Broadcast Receiver or to request action be performed on a particular piece of data.

6. Widgets

These are the small visual application components that you can find on the home screen of the devices. They are a special variation of Broadcast Receivers that allow us to create dynamic, interactive application components for users to embed on their Home Screen.

 

7. Notifications

Notifications are the application alerts that are used to draw the user’s attention to some particular app event without stealing focus or interrupting the current activity of the user. They are generally used to grab user’s attention when the application is not visible or active, particularly from within a Service or Broadcast Receiver. Examples: E-mail popups, Messenger popups, etc.

 

  1.  Android API Levels

There are various API levels in Android OS, and still, new APIs are developed as the development is going on with new features and functions in Android devices. Every new Android version introduces a new change that leads to more secure and high-performance improvements. Introducing a new API level also enhances the user experience of Android overall.

What is Android API?

Application program interface (API) is a code for a programmer that they use in their applications. This code or (API) allows you to add specific functionalities to your application. In other words, we can say that APIs are the set of protocols and tools used for building software applications.

  1.  Application Structure

Lightbox

 

  1. AndroidManifest.xml: Every project in Android includes a manifest file, which is AndroidManifest.xml, stored in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our applicationits components, and its requirements.

This file includes nodes for each of the Activities, Services, Content Providers and Broadcast Receiver that make the application and using Intent Filters and Permissions, determines how they co-ordinate with each other and other applications.

  1. Java: The Java folder contains the Java source code files. These files are used as a controller for controlled UI (Layout file). It gets the data from the Layout file and after processing that data output will be shown in the UI layout. It works on the backend of an Android application.
  2. drawable: A Drawable folder contains resource type file (something that can be drawn). Drawables may take a variety of file like Bitmap (PNG, JPEG), Nine Patch, Vector (XML), Shape, Layers, States, Levels, and Scale.
  3. layout: A layout defines the visual structure for a user interface, such as the UI for an Android application. This folder stores Layout files that are written in XML language. You can add additional layout objects or widgets as child elements to gradually build a View hierarchy that defines your layout file.
  4. mipmap: Mipmap folder contains the Image Asset file that can be used in Android Studio application. You can generate the following icon types like Launcher icons, Action bar and tab icons, and Notification icons.
  5. colors.xml: colors.xml file contains color resources of the Android application. Different color values are identified by a unique name that can be used in the Android application program.
  6. strings.xml: The strings.xml file contains string resources of the Android application. The different string value is identified by a unique name that can be used in the Android application program. This file also stores string array by using XML language.
  7. styles.xml: The styles.xml file contains resources of the theme style in the Android application. This file is written in XML language.
  8. build.gradle(Module: app): This defines the module-specific build configurations. Here you can add dependencies what you need in your Android application.

Converted to HTML with WordToHTML.net

No comments:

Post a Comment