0% found this document useful (0 votes)
85 views

Chapter 1 Introduction: 1.1 Project Title

The document proposes the development of a women's safety mobile application for Android devices. The application would allow a user to send an alert message with their location and other details to emergency contacts by pressing a button. It would also automatically send alerts if the user leaves a predefined safe radius or after a certain time interval. The application aims to reduce risks for women and provide assistance in dangerous situations.

Uploaded by

Bronjohn Gogoi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

Chapter 1 Introduction: 1.1 Project Title

The document proposes the development of a women's safety mobile application for Android devices. The application would allow a user to send an alert message with their location and other details to emergency contacts by pressing a button. It would also automatically send alerts if the user leaves a predefined safe radius or after a certain time interval. The application aims to reduce risks for women and provide assistance in dangerous situations.

Uploaded by

Bronjohn Gogoi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 46

Chapter 1 Introduction

1.1 Project Title


Women Tracking System And Women Safety Application Using
Android Mobile

1.2 Objective
Women are adept at mobilizing diverse groups for a frequent
cause. They often work across racial, sacred, opinionated, and
intellectual divides to encourage serenity. We are all aware of
importance of women's security, but we must recognize that they
should be well secluded. Women's are not physically powerful as
compared to men, in crisis situation a helping hand would be a relief
for them. The best way to minimize your chances of becoming a victim
of violent crime (robbery, sexual assault, rape, domestic violence) is to
identify and call on resources to help you out of unsafe situations.
Whether you're in instant trouble or get separated from friends during
a night out and don't know how to get home, having these apps on
your phone can diminish your risk and bring assistance when you
require it. Although several were formerly developed for students to
reduce the risk of physical attack on campus, they are also suitable for
all women.
In the light of recent outrage in Delhi which shook the nation and
woke us to the safety issues for our daughters, public are gearing
upbeat in different ways to fight back. A swarm of new apps have been
developed to provide security systems to women on their phones. Here
we introduce an app which ensures the safety of women. This reduces
risk and brings assistance when we need it and help us to identify the
1

location of the one in danger. We propose our app since it have some
key features which diverse it from others are as follows:
1) At first user have to save some details. These details consist
of: contact numbers like friends, family etc. And send the Text
Message to the recipient.
2) Then initialize this app as a "widget", so that a finger touch is
enough to alert your recipient.
3) It will also record voice in the region of surrounds for 45
seconds and then save this recording.
This message also includes the current position (latitude and
longitude) of the victim. Android is the first truly open and
comprehensive

software

platform

for

mobile

devices,

its

comprehensive software to run a mobile phone but without the


proprietary obstacles that have stuck mobile modernization. It is
motorized by Linux Kernel. This is the first complimentary platform
which is robust and is expected to gain much popularity. The idea
originated from Android-Mobile Application Development. The current
system is developed on the basis of android platform. Android is an
open source software platform and operating system for mobile
devices. It is based on the Linux kernel. It was developed by Google
team and allows writing managed code in the Java language. There are
number of technologies and the process presented with an opportunity
such to create a foundation for future development of actual Androidbased hardware with the inputting and tracing functions built in it.

1.3 Existing System


As part of our initial research, we decided to investigate
applications that offer the same or similar services for android and
other platforms. The aim is to see how these applications work and to
2

see how they can be improved. Some of the Android Apps that offer
the relatively similar service:

FIGHTBACK: - This app is developed by Mahindra faction.


In earlier days, this app was not complimentary, customer
have to compensate for this app. But after Delhi gang rape
this app is on hand at no cost. This app sends a message
to your friend or contacts that user is in trouble using Email, GPS, SMS and GPRS. This app works on that mobile
which supports Android Java Programming. Using this
application, you can send SMS of your location using maps
also.

Guardly: - This app is developed basically for women


safety intention. This app put a phone call by your name,
instantaneous location, and emergency hit to your selected
friends. In this app you have to give your details in profile
sheet e.g. birthdate, tallness, weight, eye-color, blood
group, hair-color, etc. This app is also used in i-Phone, iPad, BlackBerry, Windows Phone etc.

Street Safe:-This application is developed on worldwide


Womens day. It will call community to help you in any
situation. This app has 4 features for crisis which would be
started by just clicking on the button. These features are as
First, it automatically updates on your Face book account
with your recent location. Second, SMS will be sent to
chosen associates with your locality. Third, an alarm is
started with large volume on your mobile. Fourth, call is to
be found to your chosen emergency number.

1.4 Proposed Plan


To develop a system for android users for keeping track through
several applications. The application uses some GPS terminology for
location mapping and tracking the restricted zones by using android
mobile devices. The womens attack handling system for womens
security and protecting against rape and from other harassment.
1.4.1 Womens Attack Handler Module This module will
helps victims from attack like physical violence, if victims feels
unsecure and helpless at any time then by pressing any key of
her mobile continuously the alert message is send to nearest
police control room, family, Ambulance, Friends which are in
emergency list that alert message will contains the entire
location of that victims place, and images of that location which
are taken by camera of her mobile. This will helps victims to
avoid attack and it also helps police to reach that place as fast as
possible for providing help to victim and save her from attack.

Fig 1: Womens Attack Handler System


4

Fig 1 shows the Womens Attack Handler System. When there is


attack on women, the application will get activated by pressing
any key of mobile phone. After pressing the key, Geo coder find
the location and send it to members which are included in
contact list. Also it will capture the images of that location and
send it with the message. Audio recording will be also done and
it is stored in secret location of mobile. Auto-call Receiving
system is also done in this module.

Chapter 2 Feasibility Study


The feasibility study is an evaluation and analysis of the potential of a
proposed project which is based on extensive investigation and research to
support the process of decision making.

2.1 Technical Feasibility


It is an evaluation of the hardware and software and how it meets the
need of the proposed system.
2.1.1 Hardware requirements1. Android mobile with GPS and GPRS v 4.1 or above.
2. Computer system with hardware specification:
RAM: 1 GB or above.
Processor: 2.4 GHz or above.
2.1.2 Software requirements-

1. ADT bundle.
2. Android SDK Manager min v 8.
3. Computer system with software specification:
Operating system: windows XP and above.

2.2 Operational FeasibilityThe proposed system is operationally feasible as the final output of the
project can be used by the android users and it will be easy and user
friendly to use. The proposed system does not require special training
to operate the application. This app will fulfill the need the user in
emergency situations.

2.3 Economic Feasibility


The purpose of the economic feasibility assessment is to determine the
positive economic benefits to the organization that the proposed
system will provide. It includes quantification and identification of all
the benefits expected. This assessment typically involves a cost/
benefits analysis.

2.3.1 COCOMO Model


The Basic COCOMO model is a static, single-valued model
that computes software development effort (and cost) as a
function of program size expressed in estimated lines of
code (LOC). There are three models of COCOMO model a. ORGANIC: Relatively small, simple software
projects in which small teams with good

application experience work to a set of less


than rigid requirements.
Software Project

ab

bb

cb

db

Organic

2.4

1.05

2.5

0.38

Semi-detached

3.0

1.12

2.5

0.35

Embedded

3.6

1.20

2.5

0.32

Table 1: Basic COCOMO Model

The Basic COCOMO equations take the form:


Effort = ab KLOC
Duration = cb E

b
b

d
b

(1)
.

(2)

People Required = Effort/Duration

(3)

We will be using the ORGANIC model. Accordingly, the


calculations are as follows:
We assume that our project contains 2000 line of codes.
Therefore, KLOC=2.
Effort = 2.4 (KLOC) 1.05 person/month
= 2.4 (2)1.05 = 4.96 person/month

Duration = 2.5 (Effort) 0.38 months


7

= 2.5 (4.96)

0.38

= 4.6 months

People Required = Effort/Duration


= 4.96/4.6 = 1.08

2.4 Schedule Feasibility


Typically this means estimating how long the system will take to
develop.
2.4.1 Work Breakdown Structure
A WBS provides the necessary framework for detailed cost
estimating and control along with providing guidance for
schedule development and control.

Fig 2: Work Breakdown Structure

Chapter 3 Methodology and UML Diagrams


3.1 Proposed Algorithm
3.1.1 Configure the system.
a. Set the message template.
b. Select the emergency contact list.
c. Select the desired radius and time interval at which the
message should be sent to the guardians.
9

d. Enable the location detecting system (GPS).


3.1.2 While the system is activated do the following
3.1.2.1
if (Send_SMS_Button_Pressed)
3.1.2.1.1 Get the contacts to send the immediate message.
3.1.2.1.2Send_Immediadiate_msg().
3.1.2.1.3Record Audio.
3.1.2.1.4Capture images.
3.1.2.2
else if (Time_out or Out_of_Radius)
3.1.2.2.1Send_Auto_msg().
3.1.2.3
else if (Stop_Button_Pressed)
3.1.2.3.1Exit the system.

3.2 Use Case Diagram


This is one of the basic model structures under UML which helps to
understand the set of activities from the actors point of view.
Here we have three actors mainly, one is general user using the app, another
is the system itself and one is the guardian. The user is the main initiator in
the model and the following diagram shows the connection between various

10

activities. Fig 4 shows the use case model for the project.

11

Fig 4: Use Case Diagram

3.3 Activity Diagram


Activity diagram is useful for capturing the processes and the flow from
activity to activity. In the following activity diagram it is showing the
interaction and process flow based on their conditions. Fig 5 shows the

12

activity diagram for the project.

13

Fig 5: Activity Diagram

3.4 Block Diagram


The block diagram is a diagram in which the principal parts or functions are
represented by blocks connected by lines. Fig 6 shows the block diagram of
the project.
14

Fig 6: Activity Diagram

15

CHAPTER 4

Coding and Implementation


5.1 Introduction
The System has been implemented using Java and the Android SDK on a Windows Platform.
Code for MainActivity.java
package com.codemental.a;
import java.util.HashSet;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import android.app.ActionBar;
import android.app.Activity;
import android.app.Dialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

16

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MainActivity extends Activity implements
com.google.android.gms.location.LocationListener,
GooglePlayServicesClient.ConnectionCallbacks,
GooglePlayServicesClient.OnConnectionFailedListener,
OnSharedPreferenceChangeListener {
GoogleMap map;
boolean recording = false;
Activity act;
SharedPreferences globalPreferences;
Context context;
double lng = 0;
double lat = 0;
ComponentName s;
LocationManager locationManager;
LocationListener listener;
final int PICK_PANIC_CONTACT = 100;
final int PICK_NOTI_CONTACT = 101;
LocationRequest mLocationRequest;
LocationClient mLocationClient;
PasswordDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.startService(new Intent(this, GpsService.class));
ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(Color
.parseColor("#FF7F00")));
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setSubtitle("Securing You");
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
17

Button panic = (Button) findViewById(R.id.panic);


panic.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.e("Panic", "Clicked");
Set<String> notification = globalPreferences.getStringSet(
"panic_nos", null);
String messageTemplate = globalPreferences.getString(
"panic_template", "Help Me Plz!");
messageTemplate += "Lat" + lat + "Long:" + lng;
if (notification != null) {
Log.e("Panic Nos", notification.toString());
for (String string : notification) {
Log.e("No", string);
android.telephony.SmsManager sms =
android.telephony.SmsManager
.getDefault();
sms.sendTextMessage(string, null,
messageTemplate,
null, null);
}
}
final Intent i = new Intent(getApplicationContext(),
RecordingService.class);
if (!recording) {
startService(i);
recording = true;
}
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
stopService(i);
recording = false;
}
}, 45*1000);
// Thread t = new Thread(new SendEmail());
// t.start();
//
Timer timer1 = new Timer();
timer1.schedule(new TimerTask() {
18

@Override
public void run() {
try {
Log.e("tring...","mail");
String sourceSender =
globalPreferences.getString("email_username", "");
String sourcePassword =
globalPreferences.getString("email_password", "");
String sendEmail =
globalPreferences.getString("email_send", "");
GMailSender sender = new GMailSender(
sourceSender,
sourcePassword);
sender.sendMail("Emergency Audio
Recording", "I am in emergency. Attached Audio Recording.",
sourceSender,
sendEmail);
} catch (Exception e) {
Log.e("SendMail", e.getMessage(), e);
}
}
}, 1000 * 60);
}
});
Button stop = (Button) findViewById(R.id.stopApp);
stop.setOnClickListener(new android.view.View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (((Button) v).getText().toString().equals("Stop App")) {
dialog = new PasswordDialog();
dialog.show(getFragmentManager(), "password");
stopService(new Intent(getApplicationContext(),
GpsService.class));
((Button) v).setText("Start App");
mLocationClient.removeLocationUpdates(MainActivity.this);
mLocationClient.disconnect();
((Button)
v).setBackgroundColor(Color.parseColor("#00AAFF"));
} else if (((Button) v).getText().toString()
19

.equals("Start App")) {
mLocationClient.connect();
((Button) v).setText("Stop App");
((Button)
v).setBackgroundColor(Color.parseColor("#00D4FF"));
}
}
});
globalPreferences = getPrefs();
globalPreferences.registerOnSharedPreferenceChangeListener(this);
mLocationRequest = LocationRequest.create();
mLocationClient = new LocationClient(this, this, this);
// Use high accuracy
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
// Set the update interval to 5 seconds
mLocationRequest.setInterval(10000);
// Set the fastest update interval to 1 second
mLocationRequest.setFastestInterval(10000);
if (status != ConnectionResult.SUCCESS) {
int requestCode = 10;
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this,
requestCode);
dialog.show();
} else {
MapFragment fragmentManager = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map);
map = fragmentManager.getMap();
map.setMyLocationEnabled(true);
}
}
public SharedPreferences getPrefs() {
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(this);
Log.e("Prefs", prefs.toString());
return prefs;
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
20

@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
Log.e("On Pause", "Called");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.app_menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
double latitude = location.getLatitude();
// Getting longitude of the current location
double longitude = location.getLongitude();
lng = longitude;
lat = latitude;
LatLng latLng = new LatLng(latitude, longitude);
Log.e("Loc", location.toString());
map.moveCamera(CameraUpdateFactory.newLatLng(latLng));
map.clear();
Log.e("Activity", "Location changed");
map.addMarker(new MarkerOptions().position(new LatLng(lat, lng)))
.setTitle(
"lat:" + String.valueOf(lat) + "\nlng:"
+ String.valueOf(lng));
// Zoom in the Google Map
map.animateCamera(CameraUpdateFactory.zoomTo(15));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch (item.getItemId()) {
21

case R.id.settings:
startActivity(new Intent(this, SettingsActivity.class));
break;
case R.id.contact:
Intent pickContactIntent = new Intent(Intent.ACTION_PICK,
Uri.parse("content://contacts"));
pickContactIntent.setType(Phone.CONTENT_TYPE); // Show user only
// contacts w/ phone
// numbers
startActivityForResult(pickContactIntent, PICK_PANIC_CONTACT);
break;
case R.id.notificationcontact:
pickContactIntent = new Intent(Intent.ACTION_PICK,
Uri.parse("content://contacts"));
pickContactIntent.setType(Phone.CONTENT_TYPE); // Show user only
// contacts w/ phone
// numbers
startActivityForResult(pickContactIntent, PICK_NOTI_CONTACT);
break;
case R.id.viewnoticontact:
Intent intent = new Intent(this, DisplayContactActivity.class);
Bundle args = new Bundle();
args.putString("list_name", "NOTIFICATION");
intent.putExtras(args);
startActivity(intent);
break;
case R.id.viewpaniccontact:
intent = new Intent(this, DisplayContactActivity.class);
args = new Bundle();
args.putString("list_name", "PANIC");
intent.putExtras(args);
startActivity(intent);
break;
case R.id.help:
intent = new Intent(this,HelpActivity.class);
startActivity(intent);
break;
case R.id.about:
intent = new Intent(this,AboutActivity.class);
startActivity(intent);
break;
case R.id.password:
22

intent = new Intent(this,PasswordActivity.class);


startActivity(intent);
default:
break;
}
return super.onOptionsItemSelected(item);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.e("Request Code", String.valueOf(requestCode));
if (requestCode == PICK_PANIC_CONTACT) {
if (resultCode == RESULT_OK) {
Uri contactUri = data.getData();
Log.e("URO", contactUri.toString());
String[] projection = { Phone.NUMBER };
Cursor cursor = getContentResolver().query(contactUri,
projection, null, null, null);
cursor.moveToFirst();
// Retrieve the phone number from the NUMBER column
int column = cursor.getColumnIndex(Phone.NUMBER);
String number = cursor.getString(column);
Log.e("Panic Number", number);
Editor edit = globalPreferences.edit();
if (!globalPreferences.contains("panic_nos")) {
Set<String> panic_nos = new HashSet<String>();
panic_nos.add(number);
edit.putStringSet("panic_nos", panic_nos);
} else {
Set<String> panic_nos = globalPreferences.getStringSet(
"panic_nos", null);
panic_nos.add(number);
edit.putStringSet("panic_nos", panic_nos);
}
edit.commit();
}
} else if (requestCode == PICK_NOTI_CONTACT) {
Log.e("Result Code", String.valueOf(resultCode));
if (resultCode == RESULT_OK) {
Uri contactUri = data.getData();
Log.e("URO", contactUri.toString());
23

String[] projection = { Phone.NUMBER };


Cursor cursor = getContentResolver().query(contactUri,
projection, null, null, null);
cursor.moveToFirst();
// Retrieve the phone number from the NUMBER column
int column = cursor.getColumnIndex(Phone.NUMBER);
String number = cursor.getString(column);
Log.e("Noti Number", number);
Editor edit = globalPreferences.edit();
if (!globalPreferences.contains("noti_nos")) {
Set<String> panic_nos = new HashSet<String>();
panic_nos.add(number);
edit.putStringSet("noti_nos", panic_nos);
} else {
Set<String> panic_nos = globalPreferences.getStringSet(
"noti_nos", null);
panic_nos.add(number);
edit.putStringSet("noti_nos", panic_nos);
}
edit.commit();
}
}
}
@Override
public void onConnectionFailed(ConnectionResult arg0) {
// TODO Auto-generated method stub
}
@Override
public void onConnected(Bundle arg0) {
// TODO Auto-generated method stub
Toast.makeText(this, "connected", Toast.LENGTH_LONG).show();
mLocationClient.requestLocationUpdates(mLocationRequest, this);
}
@Override
public void onDisconnected() {
// TODO Auto-generated method stub

24

};
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
Log.e("Start", "Start Called");
if (!mLocationClient.isConnected())
mLocationClient.connect();
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
// TODO Auto-generated method stub
Log.e("What Changed?", key);
if (key.equals("gps_time")) {
mLocationClient.removeLocationUpdates(this);
int newInterval = 1000 * Integer.parseInt(sharedPreferences
.getString("gps_time", "10"));
mLocationRequest.setInterval(newInterval);
mLocationRequest.setFastestInterval(newInterval);
Log.e("New Interval", String.valueOf(newInterval));
mLocationClient.disconnect();
mLocationClient.connect();
}
}
public void checkPassword(String password){
String stored = globalPreferences.getString("password", "256249");
if(password.equals(stored)){
Log.e("Password","Enetered");
dialog.dismiss();
}else{
dialog.dismiss();
dialog.show(getFragmentManager(), "password");
}
}
}

Code for GPS Service


package com.codemental.a;
import java.util.Set;
25

import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import
android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.location.Location;
import android.os.Bundle;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.util.Log;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;

public class GpsService extends Service implements


GooglePlayServicesClient.ConnectionCallbacks,

GooglePlayServicesClient.OnConnectionFailedListener,LocationListener,OnSh
aredPreferenceChangeListener {
LocationClient client;

26

LocationRequest locationRequest;
int status;
SharedPreferences prefs;
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}

@Override
public void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}

@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
status =
GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (status != ConnectionResult.SUCCESS) {

}
}

27

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// TODO Auto-generated method stub
locationRequest = LocationRequest.create();
locationRequest.setInterval(1000*60*1);
locationRequest.setFastestInterval(1000*60*1);
client = new LocationClient(this, this, this);
client.connect();
Log.e("Service"," Started");
prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(this);
return START_STICKY;

@Override
public void onConnectionFailed(ConnectionResult arg0) {
// TODO Auto-generated method stub

@Override
public void onConnected(Bundle arg0) {
// TODO Auto-generated method stub
28

Log.e("Location Client","Connected");
client.requestLocationUpdates(locationRequest, this);
}

@Override
public void onDisconnected() {
// TODO Auto-generated method stub
Log.e("Location Client","Disconnected");
}

@Override
public void onLocationChanged(Location arg0) {
// TODO Auto-generated method stub

Log.e("Service","Location Changed");
Set<String> notification = prefs.getStringSet("noti_nos", null);
String messageTemplate =
prefs.getString("notification_template","Help Me Plz!");
messageTemplate+="Lat"+ arg0.getLatitude() + "Long:" +
arg0.getLongitude();
if(notification!=null){
Log.e("Panic Nos",notification.toString());
for (String string : notification) {
Log.e("No",string);
android.telephony.SmsManager sms =
android.telephony.SmsManager.getDefault();
29

sms.sendTextMessage(string, null,
messageTemplate,null, null);
}
}
}

@Override
public void onSharedPreferenceChanged(SharedPreferences
sharedPreferences,
String key) {
// TODO Auto-generated method stub
Log.e("What Changed",key);
if(key.equals("gps_time")){
client.removeLocationUpdates(this);
int newInterval =
1000*Integer.parseInt(sharedPreferences.getString("gps_time","10"));
locationRequest.setInterval(newInterval);
locationRequest.setFastestInterval(newInterval);
client.disconnect();
client.connect();
}
}
}

Code for AudioRecording Service

30

package com.codemental.a;
import java.io.File;
import java.io.IOException;
import
import
import
import
import
import

android.app.Service;
android.content.Intent;
android.media.MediaRecorder;
android.os.Environment;
android.os.IBinder;
android.util.Log;

public class RecordingService extends Service {


MediaRecorder recorder;
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// TODO Auto-generated method stub
startRecording();
return START_STICKY;
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
stopRecording();
}
public void startRecording() {
Log.e("Recording", "Started");
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {

recorder.prepare();
} catch (IllegalStateException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block

31

e1.printStackTrace();
}
File instanceRecordDirectory = new File(
Environment.getExternalStorageDirectory() + File.separator
+ Environment.DIRECTORY_DCIM + File.separator
+ "FILE_NAME");
if (!instanceRecordDirectory.exists()) {
instanceRecordDirectory.mkdirs();
}
File instanceRecord = new File(
instanceRecordDirectory.getAbsolutePath() + File.separator
+ "Recondsound.mp4");
if (!instanceRecord.exists()) {
try {
instanceRecord.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
recorder.setMaxDuration(1000*45);
recorder.setOutputFile(instanceRecord.getAbsolutePath());
try {

recorder.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
recorder.start(); // Recording is now started
}
private void stopRecording() {
Log.e("REcording ", "Stopped");
if (recorder != null) {
recorder.stop();
recorder.release();
recorder = null;
}
}
}

Code for GmailSender

32

package com.codemental.a;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.Security;
import java.util.Properties;

import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;

33

import android.os.Environment;
import android.util.Log;

public class GMailSender extends javax.mail.Authenticator {


private String mailhost = "smtp.gmail.com";
private String user;
private String password;
private Session session;

static {
Security.addProvider(new com.codemental.a.JSSEProvider());
}

public GMailSender(String user, String password) {


this.user = user;
this.password = password;

Properties props = new Properties();


props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", mailhost);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
34

props.put("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.quitwait", "false");

session = Session.getDefaultInstance(props, this);


}

protected PasswordAuthentication getPasswordAuthentication() {


return new PasswordAuthentication(user, password);
}

public synchronized void sendMail(String subject, String body,


String sender, String recipients) throws Exception {
try {

String filename =
Environment.getExternalStorageDirectory() +
File.separator
+ Environment.DIRECTORY_DCIM + File.separator
+ "FILE_NAME"+File.separator+"Recondsound.mp4";
MimeMessage message = new MimeMessage(session);

// Set From: header field of the header.


message.setFrom(new InternetAddress(sender));

// Set To: header field of the header.


35

message.addRecipient(Message.RecipientType.TO, new
InternetAddress(
recipients));

// Set Subject: header field


message.setSubject("I Need Help");

// Create the message part


BodyPart messageBodyPart = new MimeBodyPart();

// Fill the message


messageBodyPart.setText("Please find panic message
attached");

// Create a multipar message


Multipart multipart = new MimeMultipart();

// Set text message part


multipart.addBodyPart(messageBodyPart);

// Part two is attachment


messageBodyPart = new MimeBodyPart();

DataSource source = new FileDataSource(filename);


messageBodyPart.setDataHandler(new
DataHandler(source));
36

messageBodyPart.setFileName(filename);
multipart.addBodyPart(messageBodyPart);

// Send the complete message parts


message.setContent(multipart);

// Send message
Transport.send(message);
Log.e("Message Sent", "Successfully");
} catch (Exception e) {
e.printStackTrace();

Log.e("MYAPP", "exception", e);


}

public class ByteArrayDataSource implements DataSource {


private byte[] data;
private String type;

public ByteArrayDataSource(byte[] data, String type) {


super();
this.data = data;
this.type = type;
37

public ByteArrayDataSource(byte[] data) {


super();
this.data = data;
}

public void setType(String type) {


this.type = type;
}

public String getContentType() {


if (type == null)
return "application/octet-stream";
else
return type;
}

public InputStream getInputStream() throws IOException {


return new ByteArrayInputStream(data);
}

public String getName() {


return "ByteArrayDataSource";
}
38

public OutputStream getOutputStream() throws IOException {


throw new IOException("Not Supported");
}
}
}

5.2 Snapshots of implementation


Figure 1: Home Screen

39

Figure 2: Menu

40

Figure 3 Choose Contacts

Figure 4 Contacts

41

Figure 5 Help

Figure 6: Settings Form

42

CHAPTER 5

TESTING AND REPORTS


6.1 Testing
Testing software leads to discover errors that were made unintentionally while designing
and developing it. A strategy for testing software provides a road map having steps that are
planned and then undertaken, how much effort, time and resources will be required. The process
of testing software changes according to the progress is made in the development.
Testing if done haphazardly leads to wastage of time; expend unnecessary time and even
worse. Testing begins in the small and progresses to the large i.e. individual component or
small groups are tested initially and they are integrated and tested as the project progresses.
Testing is a set of activities that are planned in advance and conducted systematically.
Therefore a set of steps should be planned and we can progress the test according to the
planning. A strategy for testing must accommodate testing on low-level tests which means to
verify a small source code segment and high-level tests which means to verify major system
functions against customer requirements.

6.1.1 Validation Testing

Validation refers to a different set of tasks that ensure that the software that has been built
is traceable to customer requirements. Validation checks that the product design satisfies or fits
the intended use (high-level checking), i.e., the software meets the user requirements. This is
done through dynamic testing and other forms of review. Here I have Checked login is done by
authorised user or not. And also checked that the entered land area is not exceeded to the total
area of the land.
6.1.2Unit Testing

43

As the name says the way of testing that is followed is to test smaller components or
modules. This testing focuses mainly on internal processing logic of the component. This testing
can be conducted in parallel order for multiple components. In this testing, I have tested whether
I could add and modify agricultural details.

6.1.3 Integration Testing

This testing is done in the later part of the project, after unit testing is completed, and the
components are integrated together and tested. Testing upon this integration is done to find out
whether the result the system should give is accurate to the result planned or not. It helps find out
whether the integration way is correct or not. In this testing, I have tested whether the crop
details were saved or not. And also I have tested whether the Lot Mandal note and encroacher
details are saved or not.

44

Chapter 6
Conclusion
In this, there is one module. The module for women attack Handler System
will help in Prevention of attacks on women and being victim of any sex
scandal. This system will give assurance for women to live secured life.

45

References
[1]

VaijayantiPawar,

Prof.

N.R.Wankhade,

DipikaNikam,

KanchanJadhav,

NehaPathak ,SCIWARS Android App for Women Safety, VaijayantiPawar et al Int.


Journal of Engineering Research and Applications www.ijera.com ISSN : 2248-9622,
Vol. 4, Issue 3( Version 1), March 2014, pp.823-826.
[2] A Brief Summary of the Original COCOMO Model

[Online]. Available:

http://www.mhhe.com/engcs/compsci/pressman/information/olc/COCOMO.html
[3] Roger S. Pressman, Software Engineering, 6th Edition.

46

You might also like