[go: up one dir, main page]

0% found this document useful (0 votes)
28 views37 pages

CH 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 37

Mobile Application

Development

Moblie 1
Chapter One: Introduction
• What is Android?
A software stack for mobile devices that includes
– An operating system
– Middleware
– Key Applications
Uses Linux to provide core system services
– Security
– Memory management
– Process management
– Power management
– Hardware drivers

Moblie 2
General Features

• Messaging
SMS and MMS are available forms of messaging, including threaded text messaging
Android Google Cloud Messaging (GCM) is also a part of Android Push Messaging
service.

• Web browser
The web browser available in Android is based on the open-source Blink (previously
WebKit) layout engine.

• Voice based features


Google search through voice has been available since initial release.
Voice actions for calling, texting, navigation, etc. are supported on Android 2.2
onwards.

Moblie 3
Connectivity Features

• Connectivity
Android supports connectivity technologies including GSM/EDGE, Wi-Fi,
Bluetooth, LTE, CDMA, EV-DO, UMTS, NFC, IDEN and WiMAX.

• Bluetooth
Supports voice dialing and sending contacts between phones, sending files
(OPP), accessing the phone book (PBAP), A2DP and AVRCP.
Keyboard, mouse and joystick (HID) support is available in Android 3.1+, and
in earlier versions through manufacturer customizations and third-party
applications.

Moblie 4
Media Features

Streaming media support

• RTP/RTSP streaming (3GPP PSS, ISMA),

• HTML progressive download (HTML5 <video> tag).

• Adobe Flash Streaming (RTMP) and HTTP Dynamic Streaming are


supported by the Flash plugin.

• Apple HTTP Live Streaming is supported by RealPlayer for Android

Moblie 5
Media support

• Android supports the following audio/video /still media

• formats: WebM, H.263, H.264, AAC, HE-AAC (in 3GP or MP4


container), MPEG-4 SP, AMR, AMR-WB (in 3GP container),
MP3, MIDI, Ogg

• Vorbis, FLAC, WAV, JPEG, PNG, GIF, BMP, WebP.

Moblie 6
Con’t

• Hardware Support Feature


• Reading Assignment

Moblie 7
External storage

• Most Android devices include microSD slot and can read microSD cards
formatted with FAT32, Ext3 or Ext4 file system.

• Storage formatted with FAT32 is handled by Linux Kernel VFAT driver,


while 3rd party solutions are required to handle other popular file systems
such as NTFS, HFS Plus and exFAT.

Moblie 8
Advantage Android
 Multitasking

 Ease of Notification

 Easy access to thousands of applications via the Google Android Android


App Market Phone options are diverse

Moblie 9
Disadvantage of Android

• Reading Assignment

Moblie 10
Android Architecture

Moblie 11
Environment
Android application development on either of the following operating
systems:

Microsoft Windows XP or later version.


Mac OS X 10.5.8 or later version with Intel chip.
Linux including GNU C Library 2.7 or later

Moblie 12
Con’t
• Develop Android applications are freely available and can be downloaded
from the Web.
Following is the list of software's you will need before you start your Android
application programming.
• Java JDK5 or JDK6
• Android SDK
• Eclipse IDE for Java Developers (optional)
• Android Development Tools (ADT) Eclipse Plugin (optional)

Moblie 13
Setup Java Development Kit (JDK)
• You can download the latest version of Java JDK from Oracle's Java site:
Java SE Downloads. You will find instructions for installing JDK in
downloaded files, follow the given instructions to install and configure the
setup.
• Finally, set PATH and JAVA_HOME environment variables to refer to the
directory that contains java and javac, typically java_install_dir/bin and
java_install_dir respectively.

Moblie 14
Setup Android SDK
• You can download the latest version of Android SDK from Android’s official
website: http://developer.android.com/sdk/index.html.

• If you are installing SDK on Windows machine, then you will find
ainstaller_rXX-windows.exe, so just download and run this exe which will
launch Android SDK Tool Setup wizard to guide you throughout the
installation, so just follow the instructions carefully.

• Finally, you will have Android SDK Tools installed on your machine.

Moblie 15
Step 3 - Setup Eclipse IDE
• All the examples in this tutorial have been written using Eclipse IDE. So we
would suggest you should have latest version of Eclipse installed on your
machine.
• To install Eclipse IDE, download the latest Eclipse binaries from
http://www.eclipse.org/downloads/. Once you have downloaded the
installation, unpack the binary distribution into a convenient location. For
example in C:\eclipse on windows, or /usr/local/eclipse on Linux and
finally set PATH variable appropriately.
• Eclipse can be started by executing the following commands on windows
machine, or you can simply double click on eclipse.exe

Moblie 16
Step 4 - Setup Android Development Tools
(ADT) Plugin
• This step will help you in setting Android Development Tool plugin for
Eclipse.
• Let's start with launching Eclipse and then, choose Help > Software
Updates > Install New Software.
• This will display the following dialogue box

Moblie 17
Applications Component
• Application components are the essential building blocks of an Android
application.
• These components are loosely coupled by the application manifest file
AndroidManifest.xml that describes each component of the application
and how they interact.

Moblie 18
Con’t
• There are following four main components that can be used
within an Android application:

– Activities
– Services
– Broadcast Receivers
– Content Providers

Moblie 19
Activities
An activity represents a single screen with a user interface.
For example, an email application might have one activity that shows
a list of new emails, another activity to compose an email, and one
for reading emails.
If an application has more than one activity, then one of them should
be marked as the activity that is presented when the application is
launched.
An activity is implemented as a subclass of Activity class as follows:
public class MainActivity extends Activity
{
}

Moblie 20
Services
• A service is a component that runs in the background to perform long-
running operations.
• For example, a service might play music in the background while the user
is in a different application, or it might fetch data over the network
without blocking user interaction with an activity.

• A service is implemented as a subclass of Service class as follows:

public class MyService extends Service


{

Moblie 21
Broadcast Receivers
• Broadcast Receivers simply respond to broadcast messages from other
applications or from the system.
• For example, applications can also initiate broadcasts to let other
applications know that some data has been downloaded to the device and
is available for them to use, so this is broadcast receiver who will intercept
this communication and will initiate appropriate action.
• A broadcast receiver is implemented as a subclass of BroadcastReceiver
class and each message is broadcasted as an Intent object.
public class MyReceiver extends BroadcastReceiver
{

Moblie 22
Content Providers
• A content provider component supplies data from one application to
others on request. Such requests are handled by the methods of the
ContentResolver class.
• The data may be stored in the file system, the database or somewhere
else entirely.
• A content provider is implemented as a subclass of ContentProvider class
and must implement a standard set of APIs that enable other applications
to perform transactions.
public class MyContentProvider extends ContentProvider
{

Moblie 23
Additional Components
• There are additional components which will be used in the construction of
above mentioned entities, their logic, and wiring between them. These
components are:
• Fragments
• Views
• Layouts
• Intents
• Resources
• Manifest

Moblie 24
Activity Class Inheritance Hierarchy

java.lang.Object

android.content.Context

android.content.ContextWrapper

android.view.ContextThemeWrapper
android.app.Activity

Moblie 25
Environment
• Android application development on either of the following operating
systems:

• Microsoft Windows XP or later version.

• Mac OS X 10.5.8 or later version with Intel chip.

• Linux including GNU C Library 2.7 or later.

Moblie 26
Con’t
• All the required tools to develop Android applications are freely
available and can be downloaded from the Web.
• Following is the list of software's you will need before you start your
Android application programming.

• Java JDK5 or JDK6

• Android SDK

• Eclipse IDE for Java Developers (optional)

• Android Development Tools (ADT) Eclipse Plugin (optional)


Moblie 27
Step 1 - Setup Java Development Kit (JDK)
• You can download the latest version of Java JDK from Oracle's Java site:
Java SE Downloads.
• You will find instructions for installing JDK in downloaded files, follow the
given instructions to install and configure the setup.

• Finally, set PATH and JAVA_HOME environment variables to refer to the


directory that contains java and javac, typically java_install_dir/bin and
java_install_dir respectively.

• If you are running Windows and have installed the JDK in C:\jdk1.6.0_15,
you would have to put the following line in your C:\autoexec.bat file.

Moblie 28
Step 2 - Setup Android SDK
• You can download the latest version of Android SDK from Android’s official
website: http://developer.android.com/sdk/index.html.

• If you are installing SDK on Windows machine, then you will find
ainstaller_rXX-windows.exe, so just download and run this exe which will
launch Android SDK Tool Setup wizard to guide you throughout the
installation, so just follow the instructions carefully.

• Finally, you will have Android SDK Tools installed on your machine.

Moblie 29
Step 3 - Setup Eclipse IDE
• All the examples in this tutorial have been written using Eclipse IDE. So we
would suggest you should have latest version of Eclipse installed on your
machine.
• To install Eclipse IDE, download the latest Eclipse binaries from
http://www.eclipse.org/downloads/. Once you have downloaded the
installation, unpack the binary distribution into a convenient location.
• For example in C:\eclipse on windows, or /usr/local/eclipse on Linux and
finally set PATH variable appropriately.
• Eclipse can be started by executing the following commands on windows
machine, or you can simply double click on eclipse.exe

Moblie 30
Step 4 - Setup Android Development Tools
(ADT) Plugin
• This step will help you in setting Android Development Tool plugin for
Eclipse.
• Let's start with launching Eclipse and then, choose Help > Software
Updates > Install New Software.
• This will display the following dialogue box

Moblie 31
Step 5 - Create Android Virtual Device
• To test your Android applications you will need a virtual Android device.
• So before we start writing our code, let us create an Android virtual
device.
• Launch Android AVD Manager using Eclipse menu options Window > AVD
Manager> which will launch Android AVD Manager.
• Use New button to create a new Android Virtual Device and enter the
following information, before clicking Create AVD button.

Moblie 32
Activity in Android

Activity - represents the presentation layer of an Android application

• screen which the user sees.

• Activity is a Java code that supports a screen or UI.

• building block of the user interface is the activity.

• Activity class is a pre-defined class in Android and every application which has
UI must inherit it to create window.

• An Android application can have several activities and it can be switched


between them during runtime of the application.
Moblie 33
Activity Life Cycle

Moblie 34
The 7 lifecycle methods of android activity.

• 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.

Moblie 35
Additional Reading Assignment

• Software Architecture
• Android Brief History
• Android Versions

Moblie 36
Class Discussion

• “Which one is better Android or iOS? Why?”

Moblie 37

You might also like