0% found this document useful (0 votes)
34 views47 pages

Girijha

This document proposes a mobile distributed system for personal security that uses location-based alarms and reminders. The system tracks a user's location using GPS and sets off alarms when the user reaches locations associated with tasks or reminders. It allows users to enter multiple tasks or reminders linked to locations, see those locations marked on a map with distances from their current spot, and receive notifications to complete tasks at the appropriate places. The system is designed to help users keep track of work across different locations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views47 pages

Girijha

This document proposes a mobile distributed system for personal security that uses location-based alarms and reminders. The system tracks a user's location using GPS and sets off alarms when the user reaches locations associated with tasks or reminders. It allows users to enter multiple tasks or reminders linked to locations, see those locations marked on a map with distances from their current spot, and receive notifications to complete tasks at the appropriate places. The system is designed to help users keep track of work across different locations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 47

A MOBILE DISTRIBUTED SYSTEM FOR PERSONAL SECU-

RITY
Abstract:
In current system, alarms are set for particular time. Many times there are situations
where the alarm/reminder is based on your current location and not based on time. The Mobile
application installed on the mobile can give an alarm based on a particular location. Additionally,
the application would help user to find out how far the user is away from particular reminder
location on the map.
People may have different work at different places. They may forget to keep track of all
the work which is associated at different places. So we proposed a system where user will be
reminded about his work at certain place where the work is associated with. This system tracks
the user location with the help of GPS. System retrieves the user’s current geological
coordinates, with the help of this system tracks user’s current location. To use this system, user
must register by filling up the details required by the system. User must enter the user id and
password in order to login to the system. User must enter the task by specifying the location
name and work at particular place. System will provide task id to the user. User can enter
multiple tasks. After entering the task details user will get the map in which the task location will
be circled and he will get to know the distance between his current location and the task location.
Once the user clicks the start option user will get notification as he reaches near to the task
location. Notification stops only when the user clicks the finish option in the system and system
will not show the completed task. This application also works even when user does some other
task in his mobile phone. System will continuously checks the location of the user and gives
notification to the user as user reaches task location. This system helps the user to set, reset,
disable, edit and set duration of the alarms as he wishes. This system also helps to check the task
location on the map how far he is from the current location.
SYSTEM STUDY:
System analysis is a process of gathering the facts concerning the system breaking them
into elements and relationship between elements. It provides a framework for visualizing the
organizational and environmental factors that operate on a system. The quality of work
performed by a machine is usually uniform, neat and more reliable when compared to doing the
same operations manually.

Existing Drawbacks:
Most of the existing alarm is based on time not with the location. While travelling by
bus/train, have you missed your station because you were sleeping. The application “Mobile
Location Alarm” solves these problems.

Proposed System:
In our application we develop a location based alarm which retrieves the user’s current
geological coordinates. It also allow user to enter new alarm for a particular location. Along with
alarm, user can optionally put the reminder text as well. Once user is near the location, the alarm
will ring and also if there is any reminder text it will be displayed to user. User can
edit/delete/update/enable/disable the alarms.

Modules:
1. Set Alarm
2. Alarm Generator
3. Alarm Viewer
4. Map

1. Set Alarm:
This module is responsible to get inputs from user about the alarm – name of location,
expiry date of alarm, reminder description if any. This module is responsible of
converting the location name into actual geo co-ordinates and set the alarm for that
location.
2. Alarm Generator:
This module is responsible to ring the alarm if user is near to the location for
which alarm is set.

3. Alarm Viewer: This module is responsible to display the already set alarms. Allows user
to edit/delete/update alarms.

4. Map: This module is responsible to display map wherein the current location of user and
the expected location are shown on the Google map.

HARDWARE SPECIFICATION
PROCESSOR : Dual Core
HARD DISK : 256 GB
RAM : 1 GB
MONITOR : 15” Color Monitor
KEYBOARD : 104 keys Standard Keyboard
MOUSE : Standard 3 Button Mouse
Mobile : Android supported Device
Version : Android 2.1 or above

SOFTWARE SPECIFICATION
Operating System : Windows XP, Linux (android mobile)
Front end : JAVA, XML

DEVELOPMENT SPECIFICATION
Development Tools : Eclipse Juno
SOFTWARE DESCRIPTION

FRONT END

INTRODUCTION OF ANDROID

Android is a software stack for mobile devices that includes an operating system,
middleware and key applications. Android is a software platform and operating system for
mobile devices based on the Linux operating system and developed by Google and the Open
Handset Alliance. It allows developers to write managed code in a Java-like language that
utilizes Google-developed Java libraries, but does not support programs developed in native
code.

The unveiling of the Android platform on 5 November 2007 was announced with the
founding of the Open Handset Alliance, a consortium of 34 hardware, software and telecom
companies devoted to advancing open standards for mobile devices. When released in 2008,
most of the Android platform will be made available under the Apache free-software and open-
source license. Open - Android allows to access core mobile device functionality through
standard API calls. All applications are equal - Android does not differentiate between the
phone's basic and third-party applications -- even the dialer or home screen can be replaced.
Breaking down boundaries - Combine information from the web with data on the phone -- such
as contacts or geographic location -- to create new user experiences. Fast and easy development -
The SDK contains what need to build and run Android applications, including a true device
emulator and advanced debugging tools.
FEATURES OF ANDROID OS

Application framework enabling reuse and replacement of components

Dalvik virtual machine optimized for mobile devices

Integrated browser based on the open source WebKit engine

Optimized graphics powered by a custom 2D graphics library; 3D graphics based


on the OpenGL ES 1.0 specification (hardware acceleration optional)

SQLite for structured data storage

Media support for common audio, video, and still image formats (MPEG4, H.264,
MP3, AAC, AMR, JPG, PNG, GIF)

GSM Telephony (hardware dependent)

Bluetooth, EDGE, 3G, and WiFi (hardware dependent)

Camera, GPS, compass, and accelerometer (hardware dependent)

Rich development environment including a device emulator, tools for debugging,


memory and performance profiling, and a plugin for the Eclipse IDE
ANDROID ARCHITECTURE:

The following diagram shows the major components of the Android operating system. Each
section is described in more detail below:

Fig 4.1.3: Android Architecture

ANDROID RUNTIME
Android includes a set of core libraries that provides most of the functionality available in
the core libraries of the Java programming language. Every Android application runs in its own
process, with its own instance of the Dalvik virtual machine.
The VM is register-based, and runs classes compiled by a Java language compiler that
have been transformed into the .dex format by the included "dx" tool. The Dalvik VM relies on the
Linux kernel for underlying functionality such as threading and low-level memory management.

At the same level there is Android Runtime, where the main component Dalvik Virtual
Machine is located. It was designed specifically for Android running in limited environment,
where the limited battery, CPU, memory and data storage are the main issues. Android gives an
integrated tool “dx”, which converts generated byte code from .jar to .dex file, after this byte code
becomes much more efficient to run on the small processors.

Fig 4.4: Conversion from .java to .dex file

As the result, it is possible to have multiple instances of Dalvik virtual machine running on
the single device at the same time. The Core libraries are written in Java language and contains of
the collection classes, the utilities, IO and other tools.

JAVA PROGRAMMING LANGUAGE

The Java Programming language is a high-level language that can be


characterized by all of the following buzzwords:

Simple Architecture neutral

Object oriented Portable

Distributed High performance

Multithreaded Robust

Dynamic Secure

In the Java Programming language, all source code is first written in plain text files ending
with the .java extension. Those source files are then compiled into .class files by the Java
compiler(javac). A .class file does not contain code that is native to your processor; it instead
contains bytecodes – the machine language of the Java Virtual Machine. The Java launcher
tool(java) then runs your application with an instance of the Java Virtual Machine.

Because the Java Virtual Machine is available on many different operating systems, the
same .class files are capable of running on Microsoft Windows, the Solaris TM Operating
System(Solaris OS), Linux, or MacOS. Some virtual machines, such as the Java HotSport Virtual
Machine, perform additional steps at runtime to give your application a performance boost. This
include various tasks such as finding performance bottlenecks and recompiling(to native code)
frequently-used sections of your code.
JAVA PLATFORM

A platform is the hardware or software environment in which a program runs. We have


already mentioned some of the most popular platforms like Microsoft Windows, Linux,Solaris OS,
MacOS. Most platforms can be described as a combination of the operating system and underlying
hardware. The Java platform differs from most other platforms in that it’s a software-only platform
that runs on top of other hardware=based platforms.

The Java platform has two components:

The Java Virtual Machine

The Java Application Programming Interface(API)

The API is a large collection of ready-made software components that provide many useful
capabilities. Such as graphical user interface(GUI)widgets. It is grouped into libraries of related
classes and interfaces; these libraries are known as packages. The next section, what can Java
Technology Do?, highlights some of the functionality provided by the API.

The following figure depicts how the API and the Java Virtual Machine insulate the program from
the hardware.
As a platform-independent environment, the Java platform can be a bit slower than native code.
However, advances in compiler and virtual machine technologies are bringing performance close
to that of native code without threatening portability.

The general-purpose, high-level Java programming language is a powerful software


platform. Every full implementation of the Java platform gives you the following features:

Development Tools: The development tools provide everything you’ll need for compiling,
running, monitoring, debugging, and documenting your applications. As a new developer,
the main tools you’ll be using are the

Java compiler (java), the Java launcher (java), and the Java documentation tool (javadoc).

Application Programming Interface (API): The API provides the core functionality of the
Java programming language. It offers a wide array of useful classes ready for use in your
own applications. It spans everything from basic objects, to networking and security, to
XML generation and database access. The core API is very large; to get an overview of
what it contains, consult the release documentation liked to at the bottom of this page.

Development Technologies: The JDK provides standard mechanisms, such as Java Web
Start and Java Plug-In, for deploying your applications to end users.

User Interface Toolkits: The Swing and Java 2D toolkits make it possible to create
sophisticated Graphical User Interfaces (GUIs).

Integration Libraries: Integration libraries such as IDL, JDBC, JNDL,RMI, and RMI-IIOP,
enable database access and manipulation of remote objects.

FEATURES OF JAVA TECHNOLOGY

Write less code: Comparisons of program metrics (class counts, method counts, and so on)
suggest that a program written in the Java programming language can be four times smaller
than the same program in C++.

Write better code: The Java programming language encourages good coding practices, and
its garbage collection helps you avoid memory leaks. Its object orientation, its JavaBeans
component architecture, and its wide-ranging, easily extendible API let you reuse other
people’s tested code and introduce fewer bugs.

Develop programs more quickly: Your development time may be as much as twice as fast
versus writing the same program in C++. Why? You write fewer lines of code and it is a
simpler programming language than C++.
Avoid platform dependencies: You can keep you program portable by avoiding the use of
libraries written in other languages.

Write one, run anywhere: Because java applications are compiled into machine-

independent bytecodes, they run consistently on any Java platform. Distribute software
more easily: With Java Web Start technology, users will be able to launch your applications
with a single click of the mouse. An automatic version check at startup ensures that users are
always up to date with the latest version of your software. If an update is available, Java Web
Start will automatically upgrade their installation.

BACK END

INTRODUCTION OF SQLITE

SQLite is an in-process library that implements a self-contained, serverless, zero-


configuration, transactional SQL database engine. The code for SQLite is in the public domain
and is thus free for use for any purpose, commercial or private.

SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite
does not have a separate server process. SQLite reads and writes directly to ordinary disk files. The
database file format is cross-platform - you can freely copy a database between 32-bit and 64-bit
systems or between big-endian and little-endian architectures. These features make SQLite a
popular choice as an Application File Format. Think of SQLite not as a replacement for Oracle
but as a replacement for fopen()

SQLite is a compact library. With all features enabled, the library size can be less than
500KiB, depending on the target platform and compiler optimization settings. (64-bit code is larger
and some compiler optimizations such as aggressive function in lining and loop unrolling can
cause the object code to be much larger.) If optional features are omitted, the size of the SQLite
library can be reduced b made to run in minimal stack space (4KiB) and very little heap (100KiB),
making SQLite a popular database engine choice on memory constrained gadgets such as
cellphones, PDAs, and MP3 players. There is a tradeoff between memory usage and speed. SQLite
generally runs faster the more memory you give it. Nevertheless, performance is usually quite
good even in low-memory environments.

4.2.2 FEATURES OF SQLITE

 Transactions are atomic, consistent, isolated, and durable (ACID) even after
system crashes and power failures.

 Zero-configuration - no setup or administration needed.


Implements most of SQL92. (Features not supported)

 A complete database is stored in a single cross-platform disk file. Great for


use as an application file format.

 Supports terabyte-sized databases and gigabyte-sized strings and blobs. (See


limits.html.)

 Small code footprint: less than 500KiB fully configured or much less with
optional features omitted.

 Simple, easy to use API.

 Written in ANSI-C. TCL bindings included. Bindings for dozens of other


languages available separately.

 Well-commented source code with 100% branch test coverage.


Self-contained: no external dependencies.

Cross-platform: Unix (Linux, Mac OS-X, Android, iOS) and Windows (Win32, WinCE,
WinRT) are supported out of the box. Easy to port to other systems. Sources are in the
public domain. Use for any purpose. Comes with a standalone command-line interface
(CLI) client that can be used to administer SQLite databases.
SYSTEM DESIGN

SYSTEM DESIGN

System design is the process of planning a new system to complement or


altogether replace the old system.

The purpose of the design phase is the first step in moving from the problem
domain to the solution domain.

The design of the system is the critical aspect that affects the quality of the
software. System design is also called top-level design.

The design phase translates the logical aspects of the system into physical
aspects of the system.

File design

A file system is the data structure designed to support the abstraction of


the data blocks as an archive and collection of files. In other words, a file system
organizes the data blocks into files, directories, and file information. This data
structure is unique because it is stored on secondary storage (usually the disk),
which is a very slow device.

INPUT DESIGN

Input design is one of the most important phase of the system design.
Input design is the process where the input received in the system are planned
and designed, so as to get necessary information from the user, eliminating the
information that is not required.

The aim of the input design is to ensure the maximum possible levels of
accuracy and also ensures that the input is accessible that understood by the user.

The input design is the part of overall system design, which requires very
careful attention. if the data going into the system is incorrect then the processing
and output will magnify the errors.

The objectives considered during input design are:

Nature of input processing.

Flexibility and thoroughness of validation rules.

Handling of properties within the input documents.

Screen design to ensure accuracy and efficiency of the input


relationship with files.

Careful design of the input also involves attention to error


handling, controls, batching and validation procedures.
Input design features can ensure the reliability of the system and produce result from
accurate data or they can result in the production of erroneous information. The
input design of the system includes the following attributes. Such as Name, contact
number, emergency contacts.

OUTPUT DESIGN

Output design is very important concept in the computerized system, without


reliable output the user may feel the entire system is unnecessary and avoids using it.
The proper output design is important in any system and facilitates effective
decision-making. The output design of this system includes the following
information. Send emergency sms to the emergency contacts.

DATABASE DESIGN

Database design is a collection of interactive data store. It is an effective


method of defining, storing and retrieving the information in the database.

The database design is independent of any relational database management


system and it is a logical model.

The logical design is mapped according to RDBMS used for implementation.

The data contained in the database can be multiple application and users. It
prevents the unauthorized from accessing data and ensures the privacy of data.
SYSTEM DEVELOPMENT
Coding

Coding is the process of whereby the physical design specifications created by the analysis
team turned into working computer code by the programming team.

Testing

Once the coding process is begin and proceed in parallel, as each program module can be tested.

Installation

Installation is the process during which the current system is replaced by the new system.
This includes conversion of existing data, software, and documentation and work procedures to
those consistent with the new system.

Documentation

It is result from the installation process, user guides provides the information of how the
use the system and its flow.

Training and support

Training plan is a strategy for training user so they quickly learn to the new system. The
development of the training plan probably began earlier in the project. The best-suited application
package to develop the system is DOTNET under WINDOWS environment.
SYSTEM TESTING

VALIDATION TESTING

Software validation is achieved through a series of tests that demonstrates


conformity with requirements.

Thus the proposed system under consideration has been tested by validation
and found to be working satisfactorily.

Validation succeeds when the software functions in a manner that can be


reasonably expected by the customer.

Once the application was made free of all logical and interface errors,
inputting data to ensure that the software developed satisfied all the requirements of
the normal input did validation testing.

If invalid data is given in data field then invalid data entry message must show
to user.

However, the data are created with the intent of determining, whether the
system will process them correctly.

BLACK BOX TESTING

This testing method considers a module as a single unit and checks the unit at
interface and communication with other modules rather getting into details at
statement level.

Here the module will be treated as a block box that will take some input and
generate output. Output for a given set of input combinations are forwarded to other
modules.

UNIT TESTING

Unit testing focuses verification effort on the smallest unit of software i.e. the
module.

Using the detailed design and the process specifications testing is done to
uncover errors within the boundary of the module.

All modules must be successful in the unit test.

USER ACCEPTANCE TESTING


The system under consideration is tested for user acceptance by constantly
keeping in touch with the prospective system users at the time of developing and
making changes whenever required.

This is done in regard to the following points.


OUTPUT TESTING

After performing the validation testing, the next step is output testing of the
proposed system since no system could be useful if it does not produce the required
output in the specific format.

The outputs generated or displayed by the system under consideration are


tested asking the users about the format required by them. Here, the output is
considered into two ways: one is the screen and the other is printed formatted.

The output format on the screen is found to be correct as the format designed
according to user needs.

For the hard copy also, the output comes out as specified by the user. Hence
output testing does not result in any correction in the system.
SYSTEM IMPLEMENTATION

IMPLEMENTATION

Implementation is the stage in the project where the theoretical design in the
turned into a working system and is giving confidence on the new system for the
user that it will work effectively.

It involves careful planning, investigation of the current system and its


constraints on implementation, design of methods to achieve the change over, an
evaluation, of change over methods.

Apart from planning major task of preparing the implementations are


education and training of users. The more complex the system begin effort, required
just for implementation.

An implementation coordination committee based on policies of individual


organization has been appointed. The implementation process begins with preparing
a plan for the implementation of the system. After the system is implemented
successfully, training of the user is one of the most important subtasks of the
developer.

For this purpose user manuals are prepared and handled over to the user to
operate the developed system. Thus the users are trained to the operate the
developed system. Both the hardware and software securities are made to run the
developed systems successfully in future.
STAGES OF IMPLEMENTATION

The implementation stage involves following Tasks.

Careful planning.

Investigation of system and constraints.

Design of methods to achieve the changeover.

Training of the staff in the changeover phase.

The maintenance phase of the software cycle is the time in which a software
product useful work. After a system is successfully implemented, it should be
maintained in a proper manner. System maintenance is an important aspect in the
software development life cycle.

The need for the system maintenance is for it to make adaptable to change in
the system environment. There may be social, Technical and other environmental
changes, which affect a system, which is being implemented.

Software product enhancements may involve providing new functional


capabilities, improving user displays and mode of interaction, upgrading the
performance characteristics of the system. So only throw proper system maintenance
procedures, the system can be adapted to cope up with these changes.

The maintenance activity occurs because it is unreasonable to assume that


software testing will uncover all errors in large software system. During the use of
any large program, errors, will occur and be reported to the Developer.

The process that includes the diagnosis and correction of one or more errors is
called Corrective maintenance.

We develop the prototype of the Unsafe driving detection system on Android


HTC one phone. The phone provides an accelerometer sensor and an orientation
sensor. In the following part, we describe the implementation details of the
prototype.

We implement the prototype in Java, with Eclipse and Android 4.4.2 SDK. It
consists of 11 class files. They can be divided into five major components: user
interface, system configuration, data processing and alert notification.

After the system is started, it finishes the configuration automatically. The


system keeps running in background as a Service in Android, collecting and
recording the readings of sensors. These readings are processed and used to detect
unsafe driving.

When unsafe driving is detected, the alert notification component works to


alarm and remind the driver of dangerous driving and sends a message alert to
predefined number.

We compile and build the system project, create and sign the .apk file and
install it onto HTC one phone by ADB tool. The size of the .apk application file is
about 619 KB.
ARCHITECTURE DIAGRAM
SOURCE CODE

package csp.project.locationalarm;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {


TextView tv_close,tv_aset,tv_settings,tv_manage;
Intent in;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

tv_close=(TextView)findViewById(R.id.close);
tv_aset=(TextView)findViewById(R.id.setalarm);
tv_settings=(TextView)findViewById(R.id.settings);
tv_manage=(TextView)findViewById(R.id.manage);
try {

tv_close.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
tv_close.setBackgroundDrawable(getResources().getDrawable(R.-
drawable.off));
System.exit(0);
finish();

}
});
tv_aset.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
tv_aset.setBackgroundDrawable(getResources().getDrawable(R.-
drawable.off));
//in=new Intent(MainActivity.this,TrackLoc.class);
//startActivity(in);

}
});

tv_settings.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
tv_settings.setBackgroundDrawable(getResources().getDrawable(R.-
drawable.off));
in=new Intent(MainActivity.this,Settings.class);
startActivity(in);
}
});
tv_manage.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
tv_manage.setBackgroundDrawable(getResources().getDrawable(R.drawable.off));

}
});

tv_close.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
tv_close.setBackgroundDrawable(getResources().getDrawable(R.-
drawable.on));
return false;
}
});
tv_settings.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
tv_settings.setBackgroundDrawable(getResources().getDrawable(R.-
drawable.on));
return false;
}
});
tv_aset.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
tv_aset.setBackgroundDrawable(getResources().getDrawable(R.-
drawable.on));
return false;
}
});
tv_manage.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub

tv_manage.setBackgroundDrawable(getResources().getDrawable(R.drawable.on));
return false;
}
});

} catch(Exception e) {
e.printStackTrace();
display(e.toString());
}
}

public void display(String msg) {


Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
}

package csp.project.locationalarm;

import android.location.LocationManager;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class Settings extends Activity {

TextView tv_close,tv_back,tv_gps,tv_net;
Intent in;
LocationManager lm;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
tv_close=(TextView)findViewById(R.id.close);
tv_back=(TextView)findViewById(R.id.back);
tv_gps=(TextView)findViewById(R.id.gps);
tv_net=(TextView)findViewById(R.id.net);

try {

tv_close.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

tv_close.setBackgroundDrawable(getResources().getDrawable(R.drawable.off));
System.exit(0);
finish();

}
});
tv_back.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

tv_back.setBackgroundDrawable(getResources().getDrawable(R.drawable.off));
in=new Intent(Settings.this,MainActivity.class);
startActivity(in);
}
});

tv_gps.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

tv_gps.setBackgroundDrawable(getResources().getDrawable(R.drawable.off));
lm=(LocationManager)
getSystemService(Context.LOCATION_SERVICE);
boolean isGPS =lm.isProviderEnabled
(LocationManager.GPS_PROVIDER);
if(!isGPS) {
startActivityForResult(new
Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0);
Intent intent=new
Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", true);
sendBroadcast(intent);

} else {
display("GPS Enabled");
}

}
});

tv_net.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

tv_net.setBackgroundDrawable(getResources().getDrawable(R.drawable.off));
in=new Intent(Settings.this,MainActivity.class);
startActivity(in);

}
});

tv_close.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub

tv_close.setBackgroundDrawable(getResources().getDrawable(R.drawable.on));
return false;
}
});
tv_back.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
tv_back.setBackgroundDrawable(getResources().getDrawable(R.drawable.on));
return false;
}
});
tv_gps.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub

tv_gps.setBackgroundDrawable(getResources().getDrawable(R.drawable.on));
return false;
}
});
tv_net.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub

tv_net.setBackgroundDrawable(getResources().getDrawable(R.drawable.on));
return false;
}
});

} catch(Exception e) {
e.printStackTrace();
display(e.toString());
}
}

public void display(String msg) {


Toast.makeText(getApplicationContext(), msg,
Toast.LENGTH_SHORT).show();
}
}

package com.example.donorapp;

import java.util.ArrayList;
import java.util.Locale;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class Location extends Activity {


ListView listView;
Intent in;
String database = "blood.db";
String loc;
SQLiteDatabase db;
boolean dbfound = true;
ArrayList<String> names=new ArrayList<String>();
ArrayAdapter<String> adapter;

Cursor cursor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location);

final Bundle getdata = getIntent().getExtras();


if (getdata != null) {
loc = getdata.getString("address");

}
Log.e("Location", loc);

listView = (ListView) findViewById(R.id.listview1);

listView.setOnItemClickListener(new OnItemClickListener()
{

public void onItemClick(AdapterView<?> parent, View view, int


position, long id)
{
String i=adapter.getItem(position).toString();
// Log.i(TAG, i);

//HashMap<String, String> hm = adpt.getItem(position);


//String selectedFromList =(String) (listView.getItemAtPosi-
tion(position));
Intent iobj = new Intent(Location.this,UserList.class);
iobj.putExtra("uname",i);
startActivity(iobj);

}
});
try {
db = openOrCreateDatabase(database,
SQLiteDatabase.CREATE_IF_NECESSARY, null);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
dbfound = true;

} catch (Exception e) {
e.printStackTrace();
// display("Error DataBase");
}

loadSpinnerData();
}
private void loadSpinnerData() {
// database handler

names.clear();
// Spinner Drop down elements
// List<String> lables = db.getAllLabels();
cursor = db.rawQuery("select distinct(address) from info where bg='"+ loc + "'",
null);
cursor.moveToFirst();

while (!cursor.isAfterLast()) {

String pas = cursor.getString(0);


names.add(pas);
Log.e("Karthick", pas);
// Log.i("ss", usr + " " + pas);
// Toast.makeText(getApplicationContext(),
// usr,Toast.LENGTH_SHORT).show();
cursor.moveToNext();

// Creating adapter for spinner

// Drop down layout style - list view with radio button


adapter= new
ArrayAdapter<String>(this,R.layout.layout_img,R.id.name,names);
//adapter.add(pas);
// attaching data adapter to spinner
listView.setAdapter(adapter);
}}
}

package com.example.donorapp;

import java.util.ArrayList;
import java.util.Locale;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class Location extends Activity {


ListView listView;

Intent in;
String database = "blood.db";
String loc;
SQLiteDatabase db;
boolean dbfound = true;
ArrayList<String> names=new ArrayList<String>();
ArrayAdapter<String> adapter;

Cursor cursor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location);

final Bundle getdata = getIntent().getExtras();


if (getdata != null) {
loc = getdata.getString("address");

}
Log.e("Location", loc);

listView = (ListView) findViewById(R.id.listview1);

listView.setOnItemClickListener(new OnItemClickListener()
{

public void onItemClick(AdapterView<?> parent, View view, int


position, long id)
{

String i=adapter.getItem(position).toString();
// Log.i(TAG, i);
//HashMap<String, String> hm = adpt.getItem(position);
//String selectedFromList =(String) (listView.getItemAtPosi-
tion(position));
Intent iobj = new Intent(Location.this,UserList.class);
iobj.putExtra("uname",i);
startActivity(iobj);

}
});
try {
db = openOrCreateDatabase(database,
SQLiteDatabase.CREATE_IF_NECESSARY, null);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
dbfound = true;

} catch (Exception e) {
e.printStackTrace();
// display("Error DataBase");
}

loadSpinnerData();

}
private void loadSpinnerData() {
// database handler

names.clear();
// Spinner Drop down elements
// List<String> lables = db.getAllLabels();
cursor = db.rawQuery("select distinct(address) from info where bg='"+ loc + "'",
null);
cursor.moveToFirst();

while (!cursor.isAfterLast()) {

String pas = cursor.getString(0);


names.add(pas);
Log.e("Karthick", pas);
// Log.i("ss", usr + " " + pas);
// Toast.makeText(getApplicationContext(),
// usr,Toast.LENGTH_SHORT).show();
cursor.moveToNext();

// Creating adapter for spinner

// Drop down layout style - list view with radio button


adapter= new
ArrayAdapter<String>(this,R.layout.layout_img,R.id.name,names);
//adapter.add(pas);
// attaching data adapter to spinner
listView.setAdapter(adapter);
}}

package com.example.donorapp;

import java.util.ArrayList;
import java.util.Locale;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class Location extends Activity {


ListView listView;

Intent in;
String database = "blood.db";
String loc;
SQLiteDatabase db;
boolean dbfound = true;
ArrayList<String> names=new ArrayList<String>();
ArrayAdapter<String> adapter;

Cursor cursor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location);

final Bundle getdata = getIntent().getExtras();


if (getdata != null) {
loc = getdata.getString("address");

}
Log.e("Location", loc);

listView = (ListView) findViewById(R.id.listview1);

listView.setOnItemClickListener(new OnItemClickListener()
{

public void onItemClick(AdapterView<?> parent, View view, int


position, long id)
{

String i=adapter.getItem(position).toString();
// Log.i(TAG, i);

//HashMap<String, String> hm = adpt.getItem(position);


//String selectedFromList =(String) (listView.getItemAtPosi-
tion(position));
Intent iobj = new Intent(Location.this,UserList.class);
iobj.putExtra("uname",i);
startActivity(iobj);
}
});
try {
db = openOrCreateDatabase(database,
SQLiteDatabase.CREATE_IF_NECESSARY, null);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
dbfound = true;

} catch (Exception e) {
e.printStackTrace();
// display("Error DataBase");
}

loadSpinnerData();

}
private void loadSpinnerData() {
// database handler

names.clear();
// Spinner Drop down elements
// List<String> lables = db.getAllLabels();
cursor = db.rawQuery("select distinct(address) from info where bg='"+ loc + "'",
null);
cursor.moveToFirst();

while (!cursor.isAfterLast()) {

String pas = cursor.getString(0);


names.add(pas);
Log.e("Karthick", pas);
// Log.i("ss", usr + " " + pas);
// Toast.makeText(getApplicationContext(),
// usr,Toast.LENGTH_SHORT).show();
cursor.moveToNext();

// Creating adapter for spinner

// Drop down layout style - list view with radio button


adapter= new
ArrayAdapter<String>(this,R.layout.layout_img,R.id.name,names);
//adapter.add(pas);
// attaching data adapter to spinner
listView.setAdapter(adapter);
}}

}
CONCLUSION
Through this project we have gained a lot of project experience and understood related the-
ory from the books more fundamentally. The project belongs to rich client distributed system, it
has solved the problem of getting location without using GPS, data synchronization and how we
realize a
software product from the beginning. The system has been done incrementally, from requirements
study, problems analysis, design the method to solve problem, to final implementation and testing.
Even though the development process is not quite in order, the solution rises up from a lot of re-
analysis, re-design and re-implementation. The system is not perfect, it would keep working on
many improvements, the following issues could be considered as future works:
• Location database: our service provider which provides cell tower and access point location in-
formation still works on some part of Nordic countries. It is a real problem for this system, and we
will try to add more providers to our solution.

FUTURE ENHANCEMENT

There is a wide scope for future development of the software. The world of computer fields
is not static it is always subject to change. The technology which is famous today will become
outdated very next day. To keep abstract of technical improvements, the system may be
refinement. So it is not concluded. Yet it will improve with further enhancements.

It is essential to change the software when a new software arrives with more advanced
feathers. So it is much necessary for further development. Further enhancements can be done in an
efficient manner with disruption to the system.
BIBLIOGRAPHY
1. “Professional Android 4 Application Development” by Reto Meier
2. “Programming Android Java Programming for the New Generation of Mobile Devices” by
Zigurd Mennieks
3. “Android Cookbook” by Ian F Darwin

4. “Hello, Android Introducing Google’s Mobile Development Platform” by Ed Burnette

WEB REFERENCE

www.androidtutorials.com
www.codelearn.org
www.udymy.com
www.androidappcourse.com
www.javatpoint.com

You might also like