Sos 2
Sos 2
By
AKASH SURYAWANSHI
B.E., SHRI GOVINDRAM SEKSARIA INSTITUTE OF TECH & SCIENCE, INDIA, 2010
A REPORT
MASTER OF SCIENCE
2014
Approved by:
Major Professor
Dr. Daniel A. Andresen
Abstract
The aim of the project is to develop an Android application that lets its users to send
notifications in case of an emergency or a panic situation. The users can send multiple text
messages and emails on the press of a single button. The phone numbers, email ids and the
contents of the text and email messages can be set from within the application. The text
messages and emails sent, along with the content, also have the last known location of the user.
This is very helpful in tracking the whereabouts of the person. The user can also call 911 directly
from within the application, if the nature of the situation demands it.
Additionally the user of the application may allow the app to track their location. If this
option is selected, the application fetches the device’s location at about every 15 minutes and
stores it in a database. This information is very useful and can be used in a variety of ways. One
such use of the location data is from within the Android app where the user can view a map that
shows their location history over a period of time for a particular day.
Table of Contents
iii
6.1.2 Register..................................................................................................................21
6.1.3 Registered ..............................................................................................................22
6.1.4 Reset password .......................................................................................................23
6.1.5 Main screen ............................................................................................................24
6.1.6 Personal Setting page ..............................................................................................25
6.1.7 Change password....................................................................................................26
6.1.8 Contacts setting ......................................................................................................27
6.1.9 Set SMS Contacts ...................................................................................................28
6.1.10 Set SMS Message .................................................................................................29
6.1.11 Set Email contacts ................................................................................................30
6.1.12 Set Email message ................................................................................................31
6.1.13 Location records ...................................................................................................32
6.1.14 Date Picker...........................................................................................................33
6.1.15 Time Picker ..........................................................................................................34
6.1.16 Map .....................................................................................................................35
Chapter 7 - Testing .................................................................................................................36
7.1 Unit Testing ..................................................................................................................36
7.1.1 Login Screen test cases ...........................................................................................36
7.1.2 Register screen test cases ........................................................................................37
7.1.3 Main screen test cases .............................................................................................37
7.1.4 Personal settings screen test cases ...........................................................................38
7.1.5 Contacts setting screen test cases.............................................................................39
7.1.6 Location records screen test cases ...........................................................................40
7.1.7 Map test cases ........................................................................................................41
7.2 Integration testing .........................................................................................................41
7.3 Performance testing.......................................................................................................43
Chapter 8 - Future Work .........................................................................................................45
Chapter 9 - Conclusion ...........................................................................................................46
Chapter 10 - Bibliography.......................................................................................................47
iv
List of Figures
v
List of Tables
vi
Acknowledgements
This project would not have been possible without the support and guidance of my Major
Professor Dr. Daniel A. Andresen. I would like to extend my sincere gratitude to him for trusting
in my abilities and providing me with an opportunity to work with him. He has been a source of
immense knowledge, encouragement and provoked me to think innovatively.
I would also like to express my special gratitude and thanks to Dr. Torben Amtoft and Dr.
Mitchell L. Neilsen for serving on my committee and for their kind assistance and constant
guidance.
Finally, I would like to thank my family and friends for their endless support and
motivation.
vii
Chapter 1 - Introduction
SOS (which stands for Save Our Souls or Save Our Ships) has primarily been used as an
International Morse code distress signal. It is commonly used in navigation by Sailors when
under attack by Pirates or when they need help of some kind. But the signal is not limited to
navigation and is used in a more general sense whenever a notification has to be sent about a
situation that requires immediate attention.
1.1 Motivation
As much as we would like to get rid of them, panic or emergency situations are
unavoidable and usually unexpected. The nature and consequences of these situations can vary
significantly and in worst cases also be life threatening. Therefore it would be really nice to have
some mechanism by which we can notify certain people about such circumstances and increase
the chances of receiving help as soon as possible.
The need for such a mechanism increases even more as in this era of technology,
platforms exist to support them. One such platform and a very common one in that is a
Smartphone. Almost everyone today carry a Smartphone with them as they become more and
more affordable and easily available. Also within the Smartphone market Android is the clear
leader in terms of market share. According to one report, 78.1 % of the total Smartphones sold in
2013 were the Smartphones that run on Android Operating System [1]. Hence developing an
Android application becomes an obvious choice.
1
iv. Once logged in, the user is directed to the main screen of the application. This is the
screen that would open up when the user opens the application. The user can press the
panic button to send text messages and emails to the contacts set up, he can also send an
‘I am OK’ message to these contacts by clicking on the OK button. The user can also call
911 directly from within the application by pressing the 911 button. In order to avoid
unnecessary and accidental press of these buttons, the user has the option to enable and
disable these buttons.
v. The user will also see his current location on the main screen. This way he would know
his exact location and refer to it in case he makes a call to 911. This location is also sent
as a part of the text and email messages.
vi. The user can set the contacts to send the text message and emails within the app. He can
either select the contact from the contact book or can enter one manually. He can also set
the text message and the email message that would be sent.
vii. The user can enable the option to start location tracking. If this option is selected, the
application fetches the location of the device (about every 15 minutes) and stores it in an
external database.
viii. If the permission to track the location was granted, the user can at a later point see the
various locations he had been to for a time interval on a particular day. He would be
presented with a map that display these locations. The user can see the address and the
time he was at that location by clicking on the marker for a location.
2
Chapter 2 - Background
2.1 Android
Android is one of the most widely used Mobile Operating System today. It is a software
bunch comprising not only of the Operating System but also middleware and key applications.
Some of the most important features of an Android operating system is that it enables reuse and
replacement of components, it is optimized for mobile devices and tablets, it is based on the open
source Web kit engine and supports 2-D and 3-D graphics using OpenGL-ES standard.
3
Linux Kernel – This is the layer at the very bottom of the Android architecture. All other layers
run on top of the Linux kernel and rely on this kernel to interact with the hardware. This layer
contains all the essential hardware drivers which help to control and communicate with the
hardware. It provides the basic functionality like Process Management, Memory Management
and Device Management like Camera, Display, Flash etc.
Libraries – This is a set of common functions of the application framework that enables the
device to handle different types of data. Some of the most important set of libraries that are
included are – Web kit which is the browser engine to display HTML, OpenGL used to render 2-
D or 3-D graphics on to the screen, SQLite which is a useful repository for storing and sharing of
application data.
Android Runtime – The Android runtime mainly consist of the Dalvik Virtual Machine (DVM).
DVM is very much like the standard Java Virtual Machine (JVM) except that it is optimized for
mobile devices that have low processing power and low memory. DVM generates a .dex file
from the .class file at compile time and provides higher efficiency in low resources devices. Each
application has its own process and an instance of DVM. Android runtime also provides core
libraries that enable the Android developers to create applications using the Java language.
Application Framework- These are some standard class files that are available to the developer
for use. An application can directly interact with them and make use of them. The application
framework provides the most basic functionality of the phone like Location Manager, Content
Providers etc.
Applications – This is the topmost layer in the architecture and the layer where the application
that we develop fits in. This layer provides several pre-installed applications that are default for
certain things like Contacts Books, Browser etc.
4
2.2 Google Maps Android API v2
Google provides a very nice, comprehensive API for developers working with Android
and who want to use google maps in their application. Using this API one can easily add maps to
their apps and the API automatically handles access to google maps server, data downloading,
map display and response to gestures. Additionally the API can be used to add the following on
to the maps:
i. Markers that are used to show specific position on the map.
ii. Line segments (Polylines)
iii. Enclosed segments (Polygons)
iv. Various images that are shown on the map (overlays) like zoom control, compass etc.
To get started using the google maps Android API v2 one has to first obtain an API key specific
to your application by using the apps signing certificate from google’s API console. One should
also add Google play services SDK as a project on the local disk and add it as an external library
in the app.[3]
The next step is to add the google play services version to the apps Manifest file by including
<meta-data
Android:name="com.google.Android.gms.version"
Android:value="@integer/google_play_services_version"/>
Once an API key is obtained specific to the app add the following to Manifest file
<meta-data
Android:name="com.google.Android.maps.v2.API_KEY"
Android:value="Your_API_KEY"/>
One also needs to add the following permission in the Manifest file
<uses-permission Android:name="Android.permission.INTERNET" />
<uses-permission Android:name="Android.permission.ACCESS_FINE_LOCATION" />
<uses-permission Android:name="Android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission
Android:name="com.google.Android.providers.gsf.permission.READ_GSERVICES"/>
In order to add a google map you must add a fragment to your Activity using
<fragment xmlns:Android="http://schemas.Android.com/apk/res/Android"
Android:id="@+id/map"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:name="com.google.Android.gms.maps.MapFragment"/>
5
To get an instance of google map you should call the getMap() function on a MapFragment
object by
GoogleMap map = ((MapFragment)
getFragmentManager().findFragmentById(R.id.map)).getMap();
You can then add markers to this map by calling the addMarker() method on the map
map.addMarker(new MarkerOptions()
.title(address)
.position(new LatLng(latitude, longitude))
.snippet(time));
2.3 PHP
PHP is one of the most popular server side scripting language. Php scripts can be embedded
into the HTML pages. The start and the end tags for a PHP script are <? Php and ?> respectively.
PHP pages can contain text, HTML, CSS, JavaScript and more. They have the .php extension
and are executed on the server.
2.4 MySQL
It is one of the most widely used Relational database management system (RDBMS). It is
open source and available for free. It scales very well for large quantities of data, is fast, reliable
and easy to use. Like most other RDBMS it uses structured query language (SQL) for accessing
and manipulating data.
6
2.5 JSON
JSON stands for JavaScript Object Notation. It is a light weight format for storing and
exchanging objects that contain name/value pairs, array and other objects. It is language
independent i.e. although it uses JavaScript syntax, it is still language and platform independent
and many different languages support JSON parsers and libraries. The two main advantages of
JSON over other ways of exchanging data like XML are –
i. JSON is usually smaller than the corresponding XML.
ii. JSON is easier to parse and faster.
For example –
{
“products”:[
{“id”: 1,
“name”:”car”},
{ “id”:2,
“name”:”truck”}
]
}
The above JSON has two products (JSONArray) where each product is an Object (JSONObject)
with keys id and name and their corresponding values.
7
Chapter 3 - Requirement Analysis
8
v. The user shall be able to set the contacts to send text message and email from within the
application. The user must also be able to set the contents of the messages. Also the user
may select these contacts from the contact book or enter them manually.
vi. The user shall be able to start/stop location tracking. They must also be able to see their
location history from within the application.
Other non-functional requirements for the application are –
i. Providing a simple and elegant UI for the main screen. This is necessary as the user
would usually come on to this screen in case of a panic or emergency and hence each
button should be clearly visible and easily pressed.
ii. In case the option to track location is selected and there is no internet connectivity on the
device (both wireless and Cellular data), the application should be able to store the
locations offline and send them to be stored in the database once the internet
connectivity is up again.
iii. Providing a tab based view to display the different setting for the application and location
history for the user.
iv. Enabling swipe gestures for the tabbed view.
v. Displaying user friendly dialogs for picking the date, time, entering the contacts to send
text and email messages to and to enter the contents of the text and email messages.
9
For running on a device:
Operating System: Android 3.0 or higher
Cellular capabilities for SMS messages
10
Chapter 4 - Architecture & Design
11
For example, a file called Map.java will make use of Google maps Android API v2 to
connect the Android app with Google Maps Engine to render map and markers of them.
iv. Services – This is the component of the application that is typically used to perform long
background tasks that do not have a user interface. For example – a service is used to
track the location of the device at every fixed interval of time.
v. Receivers – This is the component of the application that typically listens for some events
or responses from other services. For example – A receiver is used to fetch the location
co-ordinates from the location service and then add this location to the database for
future references.
vi. SQLite – Android platform provides libraries for SQLite database. A SQLite database is
a relational database that is local to an Android device. It requires no configuration and
is available to use for an app developer. For example – SQLite is used in the app to store
various information about a user, his last known location or in case there is no internet
connectivity SQLite database stores the location until the internet connection is back up
and the records are sent to the database.
vii. Location Manager – It is used to fetch the location of the Android device. The app uses
both the GPS provider and the network provider to find the location for the device. GPS
provides more accurate data about the location but usually takes sufficient time to start
up after the connection is relinquished. Network provider on the other hand are quicker
but the accuracy is lesser than GPS.
viii. Contacts Manager – A system service that provides the contact to use so that the user can
select a contact that is already present in the contact book. When the user clicks on the
number text box to enter a number it opens up the contact book application. If the user
selects a contact and if that contact has a number associated, it is send to the SOS
application and displayed in these text boxes.
ix. Connectivity status manager- This system service tells the SOS application about changes
in the connectivity status for the device. The application uses it to make sure that if there
is no active internet connection on the device at the time of sending the fetched location
to the database, it needs to store the location in the SQLite database. The application
should also listen to the connectivity manager to make sure that once the internet is up
12
again all the locations that are stored in the SQLite database are sent over to the database
on the server and then the SQLite database is cleared.
x. Google Maps Engine – SOS app uses google maps Android API v2 to work with maps.
When this API is used, calls are made to the google maps engine to fetch the map or
place various markers on it.
xi. PHP Scripts – The SOS app sends JSON objects to various PHP scripts using HTTP
POST methods. These scripts interact with the database on the server to give a response
to the app. For example- When the user logs into the application a JSON object is
created that contains the values that the user entered into the app. This JSON is sent to a
PHP script login.php on the server that queries the DB to validate the user. If the user
credentials are valid a success response is sent back to the SOS app.
xii. Database- This is the MySQL database on the server. It is used to permanently store the
data for the SOS app. It stores information of various user, location history etc.
13
2. Use case for sending notifications
14
Chapter 5 - Android Framework Components
Android applications are written in Java. There are different integrated environments
(IDEs) that can be used to develop Android apps. SOS app is developed in eclipse using Android
software development kit (SDK). SDK tools create an Android package (.apk) that contain all the
necessary resources to install and run the app. Each app runs as a separate process in the
underlying Linux kernel and behaves like a separate user. Files within an app can be run only by
the specific user id assigned to the app. Each app also has its own instance of the Dalvik Virual
Machine (DVM). In order for the apps to share data with other apps like system services we have
to assign permissions to the app during install time. This is done by adding the required
permissions in the Manifest file.
5.1 AndroidManifest.xml
The AndroidManifest.xml (Manifest) file provides important information to the Android
system to run the app. All the components have to be declared in the Manifest file for the
Android system to be able to instantiate them. The Manifest file also contains the various
permissions needed by the application, API libraries that the app is linked with like Google maps
Android API v2, other hardware and software features that the app uses and also the minimum
API Level supported by the app. The Manifest file for the SOS app is as below:
<?xml version="1.0" encoding="utf-8"?>
<Manifest xmlns:Android="http://schemas.Android.com/apk/res/Android"
package="com.sos"
Android:versionCode="1"
Android:versionName="1.0">
<uses-sdk Android:minSdkVersion="14"
Android:targetSdkVersion="17"/>
<application Android:label="@string/app_name"
Android:allowBackup="true"
Android:icon="@drawable/ic_launcher"
Android:theme="@Android:style/Theme.Holo.Light.DarkActionBar">
<Activity Android:name="Login"
Android:label="@string/app_name">
<Intent-filter>
<action Android:name="Android.Intent.action.MAIN"/>
<category Android:name="Android.Intent.category.LAUNCHER"/>
</Intent-filter>
</Activity>
15
<Activity Android:name="Register"
Android:label="@string/title_Activity_register"
Android:parentActivityName="com.sos.Login">
</Activity>
<Activity Android:name="Registered"
Android:label="@string/title_Activity_registered"
Android:parentActivityName="com.sos.Login">
</Activity>
<Activity Android:name="Main"
Android:label="@string/title_Activity_main">
</Activity>
<Activity Android:name="Settings"
Android:label="@string/title_Activity_settings"
Android:windowSoftInputMode="adjustPan|stateHidden"
Android:parentActivityName="com.sos.Main">
</Activity>
<Activity Android:name="PasswordReset"
Android:label="@string/title_Activity_passwordreset"
Android:parentActivityName="com.sos.Login">
</Activity>
<Activity Android:name="ChangePassword"
Android:label="@string/title_Activity_passwordchange"
Android:parentActivityName="com.sos.Settings">
</Activity>
<Activity Android:name="Map"
Android:label="@string/title_Activity_map"
Android:parentActivityName="com.sos.Settings">
</Activity>
<receiver
Android:name="com.sos.library.ConnectionStatusChange"
Android:label="ConnectionStatusChange" >
<Intent-filter>
<action Android:name="Android.net.conn.CONNECTIVITY_CHANGE" />
<action Android:name="Android.net.wifi.WIFI_STATE_CHANGED"/>
</Intent-filter>
</receiver>
<receiver Android:name="com.sos.library.LocationReceiver" />
<receiver Android:name="com.sos.library.LocationReceiverForDB" />
<receiver Android:name="com.sos.library.LocationPollerDB" />
<receiver Android:name="com.sos.library.LocationPoller" />
16
<meta-data
Android:name="com.google.Android.gms.version"
Android:value="@integer/google_play_services_version"/>
<meta-data
Android:name="com.google.Android.maps.v2.API_KEY"
Android:value="AIzaSyDL8_XwvIfSu6KrcgkKaBf2Kg1omGIpwm8"/>
</application>
</Manifest>
The minimum SDK version required for the app is 14 which corresponds with Android
4.0 (Ice cream sandwich). The reason for this is that the user interface of the application uses
fragmentation and google maps which are better supported in Ice cream sandwich and above.
The Manifest file also declares the various activities like Login, Register, Registered, Main,
Settings, Reset password, Change password and Map that are used in the SOS app. Other
components declared in the Manifest file are the services and the receivers used in the SOS app.
The Manifest file also declares the Intent filters for some receivers and activities. Like the
“Android.Intent.action.MAIN” and “Android.Intent.category.LAUNCHER” filters specify an
Activity to be the main Activity that starts up when the app icon is clicked. Various permissions
like Internet, read contacts, send SMS, call phone, Wake lock, Write external storage are
provided in this Manifest file.
17
5.2 Activities
An Activity is the component of an Android app that is presented to the user and
responsible for interacting with them [4]. The Activity may cover the entire screen of the device
or may only cover a part of the screen displaying on top of another Activity. An Android app is
a collection of loosely coupled activities along with other resources where one Activity can call
another Activity at any point usually using Intents. When an Activity starts another Activity the
previous Activity is pushed on to a back stack. The back stack is a Last in – First out (LIFO)
structure maintained by the Android system for every app. When the user starts a new Activity it
is pushed on the top of the stack and displayed to the user, when the user is done with the
Activity and presses the back button, this Activity is popped from the stack and the user sees the
previous Activity. An Activity implements a number of callback methods that are invoked by
different events during the lifecycle of an Activity. The following diagram shows the various
callback methods for an Activity:
18
5.3 Intents
Intents are objects that are used to exchange messages between different app
components[6]. They are typically used for the following purposes:
i. To start an Activity by calling the startActivity() method, if the calling Activity expects a
result from the Activity being called the Activity should be started with
startActivityForResult() method.
ii. To start a service by calling the startService() method. Services are typically used to
perform long background tasks that do not require a front end.
iii. To deliver a broadcast message to various components within the same or different app
that have the corresponding Intent filter declared.
An Intent can be of two types:
i. Explicit – These are Intents that specify the name of the app component to call. Such
Intents are typically used to call components within your app. The Android system finds
the component with the specified name and immediately starts it passing it any
additional information that may have been provided in the Intent.
For example –
Intent i = new Intent(context, Map.class);
i.putExtra("key", json_string);
startActivity(i);
The above Intent is for the Map Activity in the app. It also contains extra data with key
“key” and value “json_string”. When the startActivity() method is called , the Map
Activity is started along with the extra information.
ii. Implicit – These Intents do not specify the name of a component but rather contain an
action that they would like to be performed. The Android system then finds a component
that can perform the specified action from other apps by matching the action against the
Intent Filter for the components.
19
Chapter 6 - Implementation
The SOS app is a collection of Activities and Fragments that are presented to the user.
These Activities and Fragment have associate XML files (Layouts) declared in the layout folder
which determine the graphical interface for these components. The SOS app also contains other
Service and Broadcast Receivers along with the declarations and necessary permissions in the
Manifest file in the root directory of the project. The total lines for the app are 5846 which
includes Java and XML files. Additionally there are 262 lines of PHP code to enable the app to
interact with the server. The breakdown for the lines of code is as follows
Language LOC
Java 5002
PHP 262
XML 844
Table 6-1 Lines of Code (LOC)
6.1.1 Login
20
The user should log in to SOS app using the above interface. If the user is registered, he
should enter the email id and password to log in. The user can also click on the Register button to
register for the SOS app. The user may also click on Forgot password if he does not remember
his password and wants to reset it.
6.1.2 Register
If the user is not already registered, he can register for an account on the SOS app using
the above interface. The user should provide a first name, last name, Email id, and a desired
username and should create a password. If the email id is already registered with the SOS app a
notification is shown to the user and he is not registered
21
6.1.3 Registered
Once the user has successfully registered he sees the above screen as a confirmation. The
screen shows the various details the user registered with.
22
6.1.4 Reset password
In case the user has forgotten his password, he can reset it by clicking on the forgot
password button on the Login screen. He is then send to reset password page as above. The user
can provide his email id and click on the reset button. A recovery email containing a temporary
password is sent to the user on his email id.
23
6.1.5 Main screen
This is the main screen of the application. Once the user has logged in successfully, every
time he opens the SOS app, this is the first screen presented to him. The screen contains a slider
switch to enable/disable the buttons. The user can send panic text message and email by clicking
on the panic button. He can also send “I am OK” notifications using the OK button. Also the user
may click on the 911 button to call 911 directly from within the app. The user also sees his
current location at the bottom of this screen.
24
6.1.6 Personal Setting page
The user can click on the settings icon on the action bar to open the tabbed interface for
settings. On the personal setting he can enter his phone number, start location tracking by
clicking on the check box for location logging. The user can also change his password and logout
by clicking on the respective buttons.
25
6.1.7 Change password
The user can change his password from the above screen. An email notification is sent on
the registered email id regarding the change of password.
26
6.1.8 Contacts setting
The user can set various contacts to send the text message and the emails to from the
above screen. He can also set the message that must be sent in these text and email messages
separately.
27
6.1.9 Set SMS Contacts
The user can set two contacts to will receive the SMS using the above dialog box. The
user can either enter a name and a corresponding number or he can click on the number text box
to open the contacts app. On the contacts app he can click on a particular contact to add that
contact as the name and his primary phone number as the number to send the SMS to.
28
6.1.10 Set SMS Message
The user is presented with the above dialog box to enter the message that he would like to
send as a part of the SMS messages sent in case the panic button is pressed.
29
6.1.11 Set Email contacts
The user can set three contacts that receive the emails when he presses the panic button.
He can either enter the name and the email id of the contacts or he can click on the email text
box to show the contacts list. When the user clicks on a particular contact in the list there name
and the primary email id is set in the dialog box.
30
6.1.12 Set Email message
The user is presented with the above dialog box to enter the message that he would like to
send as a part of the emails sent in case the panic button is pressed.
31
6.1.13 Location records
The user can see his location history by setting various fields in the above screen. He
must provide a date, a start time and an end time to view his location history. The To time has to
be greater than the From time.
32
6.1.14 Date Picker
The user is presented with the above date picker fragment to select a date for which he
wishes to analyze the location history data.
33
6.1.15 Time Picker
The user is presented with the above time picker fragment to select a time from which he
wishes to analyze the location history data.
34
6.1.16 Map
The user’s location history will be displayed on a map as above. His current location will
also be displayed by a blue dot on the map. The user can click on any of the markers to display
the address and the time at which he was at that particular location
35
Chapter 7 - Testing
36
button contain data. Either the about incorrect data
email or password is and the user shall not
incorrect get logged in
37
button contacts are set from the sent. A notification
contacts setting screen, after sending the
Switch is enabled message should be
shown
4. On clicking the OK SMS contacts and email No messages must be Pass
button contacts are set from the send. A notification to
contacts setting screen, the user should be
Switch is enabled shown to add contacts
5. On clicking the OK SMS contacts and email Message should be Pass
button contacts are set from the sent. A notification
contacts setting screen, after sending the
Switch is enabled message should be
shown
6. On clicking the 911 Switch is enabled A call should be Pass
button initiated to 911
7. On ending the call User must have clicked User should be sent Pass
with 911 911 button from the main back to the main page
page of SOS page of SOS app
8. Current location User must be on the main Address of the current Pass
update page location is shown at the
bottom of the page
Table 7-3 Unit test cases - 3
38
3. Phone number User must have entered a The same phone number Pass
displayed phone number previously should be displayed in
the corresponding text
box
4. Location tracking None Location tracking Pass
unchecked checkbox should not be
checked
5. Location tracking User must have started the Location tracking Pass
checked location tracking checkbox is checked
previously
39
entered contacts must be
retained
4. On clicking Set Email None A dialog box to enter Pass
message the message should be
shown. Previously
entered message should
be retained
Table 7-5 Unit test cases - 5
40
7.1.7 Map test cases
S.No Test case Pre-condition Post-condition Result
1. Map center User must have clicked on If there are location Pass
select button with valid records for that time,
entries on the location the map should be
history screen centered at the first
location
2. On clicking current None User must be able to Pass
location control see his current location
on the map represented
by a blue dot
3. On clicking a marker None User must be able to Pass
for a location see the address and the
time he was at that
location, for that
particular location
Table 7-7 Unit test cases - 7
41
password button on login to the Reset password
screen page
4. On clicking the register All fields are entered, User should be Pass
button on the register email and username are registered and directed
screen not already registered to the Registered page
with the SOS app
5. On clicking the back to User has registered. User must be redirected Pass
login screen on the to the Login screen
registered screen
6. On clicking the setting None User must be sent to Pass
icon on the action bar on the setting page with
the main screen personal settings
displayed
6. Location updates User must have checked Location tracking Pass
the location tracking service must start and
checkbox remain started as long
as the check box is
checked. A notification
should be shown to the
user about the start of
location tracking
7. On clicking the change None User must be sent to Pass
password button on the change password
personal setting screen screen
8. On clicking the logout None User must be logged Pass
Button on personal out and sent to the
setting screen login screen
5. On clicking the number User must have clicked Contact book app Pass
text box on contacts on Set SMS contact should be opened. User
setting screen must be able to click on
a contact and add his
42
name and primary
phone number in the
app. If the contact does
not have a number only
the name must be
entered and number
must display empty
6. On clicking the email User must have clicked Contact book app Pass
text box on contacts on Set Email contact should be opened. User
setting screen must be able to click on
a contact and add his
name and primary
email id in the app. If
the contact does not
have an email id only
the name must be
entered and email must
display empty
6. On clicking the select All fields on the location User must be directed Pass
button on location history history page contain to a screen that
screen valid data contains a map
Table 7-8 Integration test cases
43
The performance was tested on an android device “Moto G” running Android Kitkat
(4.4.2). The response times (worst case times in 10 runs) for different screens in the SOS app are
as below:
In addition to the above screens the time taken to submit the text messages (to the service
provider) and emails (to the PHP script for delivery) was measured to be 1594ms. The actual
time of delivery to the physical device of the recipient is a factor not in control of the SOS app
rather it is determined by the Carrier Service or the Internet Service Provider.
44
Chapter 8 - Future Work
The current work on the SOS app has a lot of essential features that would be used in case
of an emergency situation like sending text messages , emails and making calls to 911 from
within the app on tap of a single button. An app for such a purpose has a lot of scope for
enhancement. In the future the app may include features like –
i. A home screen widget that can be used as a triggering point to send panic notifications. A
user would then not have to open the app to send these panic notifications.
ii. Initiating a call to a number set from within the application when the user presses the
panic button.
iii. The app can also listen to incoming messages from the set contacts. If these message
have a pre-defined text like “UPDATE LOCATION” the app can reply with a text
message containing the current location or for some other text like “AUDIO” in which
case the app can record a short audio and send it as an email to the person. This is very
helpful as you may have already pressed the panic button and may be in some trouble
where you cannot reply. This way the person can track you constantly and also
understand something about the nature of the emergency from the audio clip.
iv. Setting up a password to stop the application.
45
Chapter 9 - Conclusion
SOS is an essential app to have on a Smartphone. It is a personal security app that lets
you send notifications to certain people via text messages and emails in case of emergencies. It
also gives you the ability to call 911 on the tap of a single button. The app also keeps a track of
your current location so that you always known the address of where you are. This can be very
helpful if you would need to make a call to 911. The text messages and email sent also have this
location information.
The app can also track your location periodically and store it permanently enabling you to
see your location history. You can for any particular day see the various locations that you had
been to using the app.
SOS app was my first attempt at an Android application. It gave me very good exposure
to the Android platform and mobile development in general. The app enabled me in
understanding the basic of Android development and learning about SQLite databases, Google
Maps API for Android and performance testing the app.
46
Chapter 10 - Bibliography
3. Developers, Google. Google Maps Android API V2. [Online] April 15, 2014.
https://developers.google.com/maps/documentation/Android/.
47