You are on page 1of 13

2.

LITERATURE SURVEY
The basic components of an Android application include Activity, Broadcast Receiver, Service,
and Content Provider. Each of these which when used for any application has to be declared in
the AndroidManifest.xml. The user interface of the component is determined by the Views. For
the communication among these basic components we use Intents and Intent filters which play
crucial role during app development

2.1 Activity
An Activity is, fundamentally, an object that has a lifecycle. An Activity is a chunk of code that
does some work; if necessary, that work can include displaying a UI to the user. It doesn't have
to, though - some Activities never display UIs. Typically, we will designate one of our
application's Activities as the entry point to our application

2.2. Broadcast Receiver


Broadcast Receiver is yet another type of component that can receive and respond to any
broadcast announcements.

2.3. Service
A Service is a body of code that runs in the background. It can run in its own process, or in the
context of another application's process, depending on its needs. Other components "bind" to a
Service and invoke methods on it via remote procedure calls. An example of a Service is a media
player; even when the user quits the media-selection UI, she probably still intends for her music
to keep playing. A Service keeps the music going even when the UI has completed.

2.4. Content Provider


Content Provider is a data storehouse that provides access to data on the device; the classic
example is the Content Provider that's used to access the user's list of contacts. Our application
can access data that other applications have exposed via a Content Provider, and we can also
define our own Content Providers to expose data of our own.

2.5. Intents
Intent is a simple message object that represents an "intention" to do something. For example, if
our application wants to display a web page, it expresses its "Intent" to view the URI by creating
an Intent instance and handing it off to the system. The system locates some other piece of code

(in this case, the Browser) that knows how to handle that Intent, and runs it. Intents can also be
used to broadcast interesting events (such as a notification) system-wide. There are two types of
intents namely implicit and explicit intents. Implicit intents has no specified component where as
Explicit intents do specify the component.

2.6. AndroidManifest.xml
The AndroidManifest.xml file is the control file that tells the system what to do with all the toplevel components (specifically activities, services, intent receivers, and content providers
described below) we have created. For instance, this is the "glue" that actually specifies which
Intents our Activities receive.

2.7. Views
A View is an object that knows how to draw itself to the screen. Android user interfaces are
comprised of trees of Views. If we want to perform some custom graphical technique (as we
might if we're writing a game, or building some unusual new user interface widget) then we
would create a View.

2.8. Notification
A Notification is a small icon that appears in the status bar. Users can interact with this icon to
receive information. The most well-known notifications are SMS messages, call history, and
voicemail, but applications can create their own. Notifications are the strongly-preferred
mechanism for alerting the user of something that needs their attention.

2.9.The Location Object


The Location object represents a geographic location which can consist of a latitude, longitude,
time stamp, and other information such as bearing, altitude and velocity. There are following
important methods which you can use with Location object to get location specific information:
Sr.No.

Method & Description

float distanceTo(Location dest)


Returns the approximate distance in meters between this location and the given location.

float getAccuracy()
Get the estimated accuracy of this location, in meters.

double getAltitude()
Get the altitude if available, in meters above sea level.

float getBearing()
Get the bearing, in degrees.

double getLatitude()
Get the latitude, in degrees.

double getLongitude()
Get the longitude, in degrees.

float getSpeed()
Get the speed if it is available, in meters/second over ground.

boolean hasAccuracy()
True if this location has an accuracy.

boolean hasAltitude()
True if this location has an altitude.

10

boolean hasBearing()
True if this location has a bearing.

11

boolean hasSpeed()
True if this location has a speed.

12

void reset()
Clears the contents of the location.

13

void setAccuracy(float accuracy)


Set the estimated accuracy of this location, meters.

14

void setAltitude(double altitude)

Set the altitude, in meters above sea level.


15

void setBearing(float bearing)


Set the bearing, in degrees.

16

void setLatitude(double latitude)


Set the latitude, in degrees.

17

void setLongitude(double longitude)


Set the longitude, in degrees.

18

void setSpeed(float speed)


Set the speed, in meters/second over ground.

19

String toString()
Returns a string containing a concise, human-readable description of this object.

2.10.Get the Current Location


To get the current location, create a location client which is LocationClient object, connect it to Location
Services using connect() method, and then call itsgetLastLocation() method. This method returns the most
recent location in the form ofLocation object that contains latitude and longitude coordinates and other
information as explained above. To have location based functionality in your activity, you will have to
implement two interfaces

GooglePlayServicesClient.ConnectionCallbacks

GooglePlayServicesClient.OnConnectionFailedListener

These interfaces provide following important callback methods, which you need to implement in your activity
class
Sr.No.

Callback Methods & Description

abstract void onConnected(Bundle connectionHint)

This callback method is called when location service is connected to the location client
successfully. You will use connect() method to connect to the location client.
2

abstract void onDisconnected()


This

callback

method

is

called

when

the

client

is

disconnected.

You

will

usedisconnect() method to disconnect from the location client.


3

abstract void onConnectionFailed(ConnectionResult result)


This callback method is called when there was an error connecting the client to the service.

2.11.Get the Updated Location


If you are willing to have location updates, then apart from above mentioned interfaces, you will need to
implement LocationListener interface as well. This interface provide following callback method, which you
need to implement in your activity class
Sr.No.

Callback Method & Description

abstract void onLocationChanged(Location location)


This callback method is used for receiving notifications from the LocationClient when the
location has changed.

2.12.Location Quality of Service


The LocationRequest object is used to request a quality of service (QoS) for location updates from
the LocationClient. There are following useful setter methods which you can use to handle QoS. There are
equivalent getter methods available which you can check in Android official documentation.
Sr.No.

Method & Description

setExpirationDuration(long millis)
Set the duration of this request, in milliseconds.

setExpirationTime(long millis)

Set the request expiration time, in millisecond since boot.


3

setFastestInterval(long millis)
Explicitly set the fastest interval for location updates, in milliseconds.

setInterval(long millis)
Set the desired interval for active location updates, in milliseconds.

setNumUpdates(int numUpdates)
Set the number of location updates.

setPriority(int priority)
Set the priority of the request.

2.13.Displaying a Location Address


Once you have Location object, you can use Geocoder.getFromLocation() method to get an
address for a given latitude and longitude. This method is synchronous, and may take a long
time to do its work, so you should call the method from the doInBackground()method of
an AsyncTask class.

3.System Analysis
3.1.Architecture of Android OS:
Android operating system is a stack of software components which is roughly divided into five
sections and four main layers as shown below in the architecture diagram.

3.1.1.Linux kernel
At the bottom of the layers is Linux - Linux 3.6 with approximately 115 patches. This provides
a level of abstraction between the device hardware and it contains all the essential hardware
drivers like camera, keypad, display etc. Also, the kernel handles all the things that Linux is
really good at such as networking and a vast array of device drivers, which take the pain out of
interfacing to peripheral hardware.

3.1.2.Libraries
On top of Linux kernel there is a set of libraries including open-source Web browser engine WebKit, well
known library libc, SQLite database which is a useful repository for storage and sharing of application data,
libraries to play and record audio and video, SSL libraries responsible for Internet security etc.

3.1.3.Android Libraries
This category encompasses those Java-based libraries that are specific to Android development. Examples of
libraries in this category include the application framework libraries in addition to those that facilitate user
interface building, graphics drawing and database access. A summary of some key core Android libraries
available to the Android developer is as follows

android.app Provides access to the application model and is the cornerstone of all
Android applications.
android.content Facilitates content access, publishing and messaging between
applications and application components.
android.database Used to access data published by content providers and includes
SQLite database management classes.
android.opengl A Java interface to the OpenGL ES 3D graphics rendering API.
android.os Provides applications with access to standard operating system services
including messages, system services and inter-process communication.
android.text Used to render and manipulate text on a device display.
android.view The fundamental building blocks of application user interfaces.
android.widget A rich collection of pre-built user interface components such as
buttons, labels, list views, layout managers, radio buttons etc.
android.webkit A set of classes intended to allow web-browsing capabilities to be built
into applications.
Having covered the Java-based core libraries in the Android runtime, it is now time to turn our
attention to the C/C++ based libraries contained in this layer of the Android software stack.

3.1.4.Android Runtime
This is the third section of the architecture and available on the second layer from the bottom. This section
provides a key component called Dalvik Virtual Machine which is a kind of Java Virtual Machine specially
designed and optimized for Android.
The Dalvik VM makes use of Linux core features like memory management and multi-threading, which is
intrinsic in the Java language. The Dalvik VM enables every Android application to run in its own process,
with its own instance of the Dalvik virtual machine.
The Android runtime also provides a set of core libraries which enable Android application developers to
write Android applications using standard Java programming language.

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

Location based services is an umbrella term is used to describe the different technologies used to
find the current location of a device. The main LBS elements include:
Location Manager
Location Provider
Location Manager acts as a hook to LBS. Each of the Location providers represent a different
location finding technology used to find the current location of a device Perform following tasks:
Findind current location

Tracking the movement


Setting proximity alerts for specified locations
Checking all the available location providers
We can use the Location Controls in DDMS perspective directly into emulators GPS Location
Provider either mutually or by using KML (or GPX) tabs in Location Controls. In the Manual
tab, we can send geo coordinates (latitude an GPX stands for GPS Exchange format. Most GPS
systems record tracking files using GPX. KML stands for Keyhole Markup Language. It is used
extensively online to define geographic information. We can write KML file by our hand or
gener locations. The most common location providers are GPS provider and Network provider.
They can be accessed by using the static string constants mentioned below that can return name:
LocationManager.gps_provider
LocationManager.network_provider
To access a specific provider we can use getProvider() method as shown in the following code
snippet:
String providerName = LocationManager.gps_provider; LocationProvider gpsProvider;
gpsProvider = locationManager.getProvider (providerName);

3.2.LOCATION BASED SERVICE ARCHITECTURE:

All In order to make LBS services possible, some infrastructure elements are necessary,
including mobile devices, applications, communication network, positioning component, and
service servers Mobile devices are tools used by users to access LBS services, to send requests
and retrieve results. Such devices can be portable navigation devices (PNDs), Personal Data
Assistants (PDAs), laptops, mobile phones, and so on. Application is the interface for users to
access the LBS service. It is usually software developed by an application provider, downloaded
and installed on user's mobile device. A specific application is usually developed for a specific
LBS service. Due to the restrictions of mobile devices (small screen size, limited processor
power and memory, battery capacity), LBS applications need to be lightweight and battery
saving.
3.3.LBS COMPONENTS:
3.3.1.LBS Application

This represents a specific application such as a find my friends application. This consists of a
Smartphone component, which has a number of sensors, and potentially a server component that
includes application specific data (such as location-tagged information
3.3.2.LBS Middleware
This wraps access to Core LBS Features (Location Tracking, GIS Provider and Location
Collection Services) to provide a consistent interface to LBS applications.
3.3.3.Location Tracking
This component stores the location trace of individual users. This represents a fundamental
component in next generation LBS as it contains the data that allows a users route to be
determined and potentially predicted. In particular, this component would typically support the
following functionality:
1. Keep records on users current and past locations.
2. Notify other components when a specific user has moved, or when they move in or out of an
area. This supports location-based notifications being sent to users.
3. Determine which users are within a defined location this supports geo-casting features.
4. Queries of location trace to generate user movement models
3.3.4.GIS Provider
This component provides geospatial functionality for many LBSs including map information,
map visualization and directory services. Google Maps with its API can be considered a GIS
provider.
3.3.5.Location Collection Service
This component performs location collection to get a latitude and longitude for a specific user.
Depending on the technology, this component may be accessed via the LBS Middleware (e.g.,
mobile network triangulation via a service provider) or directly (e.g., via GPS receiver in the
Smartphone). Android provides access to the above components to facilitate the implementation
of LBS services through the help of following classes;
1. Location Manager
2. Location Provider
3. Geo-coding
4. Google-Map

3.3.6.Location Manager
Location Manager Class of android is present to manage all other components needed to
establish a LBS system.

3.3.7.Location provider
Location provider represents the technology to determine the physical location i.e. to handle GIS.
Location Provider component of Android application is a present to facilitate the determination
of available provider and selection of suitable one.

You might also like