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

Utilization of Mobile and Communication Technology For Geospatial Data Collection With Special Reference To Disaster Incident

This document discusses utilizing mobile and communication technology for geospatial data collection, specifically regarding disaster incidents. It presents a proposed architecture for geospatial data collection developed by the author. The thesis was submitted to the Faculty of Graduate Studies at the University of Sri Jayewardenepura in partial fulfillment of a Master of Science degree in GIS and Remote Sensing.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
325 views

Utilization of Mobile and Communication Technology For Geospatial Data Collection With Special Reference To Disaster Incident

This document discusses utilizing mobile and communication technology for geospatial data collection, specifically regarding disaster incidents. It presents a proposed architecture for geospatial data collection developed by the author. The thesis was submitted to the Faculty of Graduate Studies at the University of Sri Jayewardenepura in partial fulfillment of a Master of Science degree in GIS and Remote Sensing.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 137

Utilization of Mobile and Communication

Technology for Geospatial Data


Collection: with Special Reference to
Disaster Incident

Lin
Narasi ngha Kesara B andaral age Cham ira Lasantha

Karunarathne

GS &

28 MAY 2016

MSc 2016
ayewarde
Utilization of Mobile and Communication
Technology for Geospatial Data
Collection: with Special Reference to
Disaster Incident

Narasingha Kesara Bandaralage Chamira Lasantha Karunarathne

Thesis Submitted to the Faculty of Graduate Studies University of

Sri Jayewardenepura for the Partial Fulfillment of Master of

Science Degree in GIS and Remote Sensing on 281h May 2016


DECLARATION OF THE CANDIDATE

I do here by declare that work described in this thesis was carried out by me under the
supervision of Dr. Shirantha Heenkenda and Mr Prabath Malavigeand report on this thesis
has not been submitted in whole or in part to any University or any other institution for
another Degree/Diploma.

Date ...............
NKBCL Karunarathna
ACKNOWLADGEMENTS

I express my sincere gratitude to both my supervisors for their patience and perennial
SUpJ)Ort and guiding me through my MSc. Thesis. I would like to thank Mr Prabath
Malavige my Technical supervisor, for his visionary approach towards problem definition
of this research and critical review of thesis. Dr. Shirantha Heenkenda, my
internalsupervisor, with his profound knowledge and field experience, helped me frame
constructive ideas and in successful development of the application.

I am very grateful to Col Rasika Kahandagamage, Chief Coord, IT/GIS WING,


Centre For Research and Development (CRD)for sharing his knowledge and experience
about systems. I appreciate his support and motivation, which gave a meaningful direction
to my research.

I am thankful to my family for being my pillars of strength. My wife Geetha, for always
keeping my spirits high, encouraging me to bring out the best in me and motivating me to
always aim high and strive for perfectioni. I so blessed to have such a wonderful family.

I]
TABLE OF CONTENT

Dcclaration of the candidate


Acknowladgements
List of figures v
List of tables vi
Abstract viii

CHAPTER ONE
INTRODUCTION
1.1. Introduction 1
1.2. Study Area 3
1.3. Problem 5
1.4. Significant of The study 6
1.5. Objectives 10
1.6. Methodology 11
1.7. Thesis Structure 14

CHAPTER TWO
DETERMINING USAGE OF MODERN TECHNOLOGY FOR DISASTER 15
2.1. Disaster Management With modern Technology 15
2.2. Role of intbniiation in disaster management 18
2.3. Disaster Communication 19
2.4. Mobile Technology 21
2.5. Mobile Development 22
2.6. Features, Constrains, Consideration in mobile technology 25
2.7. Android Development 29
2.8. Related works in android 30
2,9. Dealing with disruption communication 33

U
2.110. Mobile Data collection 34
2.11. Basic components of the MDC's 36

iMIai1H-t4*1
TEChNICAL INNOVATION 39
3.1. Existing mobile data collection systems 39
3.2. Mobile implementation in developing countries 40
3.3. Mobile based data collection in developing countries 40
3.4. Existing system for incident reporting 41
3.5. Android Platform 42
3.6. Android Application and Development Environment 42
3.7. Proposed Android tool for geo-spatial data collection 43

CHAPTER FOUR
RESULT AND DISCUSSION 62
4.1 Features 62
4.2 Data Backup 72
4.3 Application Capabilities 72
4.4 Security Measures 73
4.5 Application Testing 74
4.6 GIS for Emergency Management 77
4.7 Discussion 79

CI-IAPTER FIVE
CONCLUSION AND RECOMMENDATION 82
References 86
Appendix

LIYA
List of Figures

1: android capabilities 2
1.2 : Proposed architecture for geospatial data collection developed by author 14
2.1 : Graphical Comparison of disaster occurrence and impacts: 16
2.2 : 2015 fli-si semester natural disaster occurrence and impacts: CRED Research Institute

Health & Society (IRSS) 16


2.2 : Comparing Native app with HTML 5 24
3.1 : Android data collection system 47
3.2 : Proposed system Data flow diagram 52
3.3 : Component diagramed of Mobile end and WEB end 53
3.4 : Architecture of LBS Adapted from lesie (2014) 54
3.3 : WAMP Configuration and Installation 56
3.3 : Eclipse (IDE) used for application development 57
4.1 : Home Page of the Global Disaster Risk Analysis Application 64
4.2: Android Tracking Application 65
4.3 : Tracking Data on web interface 65
4.4 : Situational Reporting Android application 67
4.5 : Situational Reporting application 68
4.6 : Situational Reporting application 69
4.5 : Demand App 70
4.6: Denguc application Methodology 71
4.7 : Dengue application Window 71
4.8 : Global Testing 74

I!A
List of Tables

3.1 : Functional Requirement 46


3.2 : System Lifecycle 46
3.3 : system non functional requirement 47
3.4 : Add new incident in use case description 48
3.5 : Data connection availabilityin use case description 48
3.6 : Location service in use case description 49
3.7: Sync data to serverinuse case description 50
3.8 : Display data in use case description 51
4.1: Testing result of the situation report app 75
4.2 : Time variation with network coverage 75
4.3 : Findings table 81
List of Abbrivation

G IS Geographical Information System


CRD Center for Research and Development
CPU Central Processing Unit
ARM Architecture Acorn RISC Machine
LG Life's Good
GPS Global Positioning System
GLONASS Global Navigation Satellite System
GNSS Global Navigation Satellite System
API Application Program Interface
WWW World Wide Web
HTML Hyper text markup language
MYSQL structured Query Language
GPRS General Packet Radio Service
OS Operating System
MGIS Mobile GIS
XML Extensible Markup Language
ICT Information and Communications Technology
SDK System Development Kit
CSS Cascade Style Sheets
LBS Location Based Service
A-GPS Assistant GPS
MDCS Mobile Data Collection System
PDA Personal Digital Assistant
SMS Sort Message Service
ICT41) In fonnation and Communication Technologies for Development
DEX Dalvic Executable
ECG Electrocardiogram
IDE Integrated Development
ADT Android Development Tool
HTTP Hyper Text Transfer Protocol
WAMP Windows Apache Mysqi PHP
JRE Java Runtime Environment
JDK Java Development KIT
CAD Computer Aid Development

vii
ABSTRACT

The scope of information technology is leveraged in every aspect of society. Spatial data
and related information is a major requirement in disaster management. During rescue
operations, availability of i-cal-time information on a portable device would prove useful.
The aim of this research was to develop and test a GIS-hased mobile application on the
Android platform with disaster speciflc software modules. This mobile application is
expected to serve disaster management teams during the rescue operations for better co-
ordination and information exchange.

When consider about the urgent and time sensitive nature of disaster situations it is
compulsory to collect and use spatial information of the relevant disaster during a short
period of time. This would be achieved in a collaborative effort by all the parties involved
in disaster management process. But there are substantial problem with collection, access,
dissemination and usage of required spatial data for disaster management. Such pi-oblems
become more serious during disaster management phase with its dynamic and time
sensitive nature. In other words any problem of delay in data collection, access, usage and
dissemination has negative impacts on the quality of decision making and the quality of
disaster response. In this regard disaster situational reporting system would be much
important to succeed in collecting and sharing such spatial data in relation to disasters.

With the purpose ol succeed the above intention smart phone is the ideal equipment. Today
smart phones are becoming the primary computing and communication platform for
peoples daily tasks. Since these smart phones have the functions of installing applications
and provide users with more diversified mobile value added services. Most of these smart
phones are inbuilt with GPS technology. Since the current mobile communication follows
the development trends of GPS technology, make users can retrieve location data by using
map applications and navigational applications. Hence mobile application would be a
feasible route for disaster communication. On this purpose of field data collecting and real
time updating about disasters can be highly improved by using geographical information

viii
technologies. Since then this new source of information, has been found to be especially
useful in disaster management.

This paper aims to address the role of Mobile GPS as an integrated application
forfacilitating disaster management by improving field data collection and in-
fielddecisionrnaking by using Android technology.

Keywords: Disaster management system, Mobile communication, Disaster situational


report system, Mobile GPS, Spatial data,

lx
Chapter One
INTRODUCTION

I.I. Introduction
The processing capability on today's smart phones has almost doubled over the past few
years. For example the Apple 3GS iPhone uses a 600 MHz Cpu 256MB of RAM ARM
cllJJ), while the iPhone 4 uses the A4 chip which runs at I GHz. With the introduction of
multi-core phones in late 2010 mobile software can take advantage of increased speed and
performance. Many of 2010's top smart phones had a I GHz processor - devices such as
Apple's iPhone 4, HTC's Desire HD and the Windows Phone 7 handsets that arrived
towards the back end of 2010. After this dual-core phones such as the LG Optimus 2X
came on the market The 2X has aNvidiaTegra 2, 1 GHz processor - a dual-core system-on-
a-chip based on ARM architecture. The Tegra chip still promises 1GHz of processing
power however, dual-core chips enable more power to be squeezed out of the processor
because the chips contain two 1GHz cores - meaning there are two lGl-Iz processors that
can be used in parallel to speed up performance, provided the mobile software has been
optimized to take advantage of the parallel processing power. Dual-core chips should
enable a noticeable speed and performance increase, particularly when it comes to
multitasking. In 2013 the latest smart phones feature multi-core processors with dual and
quad-core processors avail able.

This availability of increased processing power coupled with smart phones that have
numerous inbuilt sensors such as GPS positioning sensors, Wi-Fi, Bluetooth, camera,
pressure, temperature, humidity, light and inertia sensors such as digital compass,
accelerometers and gyros, has created a powerful tool which can be used for surveying and
geographical information data collection. In addition many top end smart phones are
starting to use multi-constellation GNSS chips for example the iPhone 4S, iPhone 5 and
Samsung Galaxy Note use a GPS+GLONASS GNSS chipset. This hardware does not exist
in isolation but benefits from advances in computer science, in particular the emergence of
Web 2.0, as well as the availability of broadband and 3G communication networks. Smart
Phone platforms such as Apple or Android provide an API for developers to write their
own software with additional APIs in Android to utilize Google maps. There are also APIs
available for use with Open source maps such as OpenStreetMap.

Figure 1.1: android capabilities

Geospatial data collection is one of the important tasks for many spatial information users.
Geospatial data collection may include remote sensing data, field data and other in-house
GIS data conversion processes (i.e. scanning, georeferencing, digitizing, etc). Among
them, field data collection is one of the first steps for spatial information users, especially
for geographers, geologists, biologists, crop scientists, ecologists, etc. Field data collection
is required for several reasons, such as collecting Ground Control Points (GCPs), ground
truth data collection for result validation, collecting soil contaminated sites, plant or animal
species, and gathering public opinions for retail market analysis in order to analyze the
spatial distribution patterns of objects and information on their associated attributes.

2
Accurate field data collection is also necessary for adequate spatial data analysis and
proper decision making. While much of the underlying technology is already available,
there are challenges with respect to the usability of mobile applications. Traditional field
data collection (i.e. pen-and-paper based) is a time consuming and bulky task. For

example, need to prepare base maps, collect secondary dataset, and other paperwork. This
is not practical to use in real-time disaster information collection, which occurs in
unpredictable places and requires a quick emergency response. However, recent
developments in mobile communication, Global Navigation Systems, the Internet and
portable computational devices such as Notebooks or Ultra Mobile Personal Computers
(UMPC) allow us to conduct field data collection in a timely manner. More-over, under the
client-server setting for field data collection, a field user may take advantage of digital
repositories prel)ared for data collection (i.e. base maps, satellite), as well as information

resources more generally available via the Web. For example, use of Web Map Service
(WMS) to access Google Maps or Microsoft Ring Maps data from GIS applications via a
HTTP interfoce. It can provide Google Map or Microsoft Ring Maps image data to any
GIS applications that can use a WMS service for raster data. This can eliminate the time
for baseman preparation and other image processing tasks.

This project investigates the usability of a mobile application for field data collection in a
disaster situation. And also construct a Web-based GIS system to integrate, store, share
and retrieve the collected data in real-time, which could he used for example in metro-
logical data collection (i.e. surface temperature, wind speed/direction) and damage
information in disaster areas at various locations.

1.2. Study Area

The study area of this application covers WebOlS application, Geographic Information
System (GIS), GPS, GSMCartography and Android application. In this research, I present
a set of algorithms and web tools for automating analysis and comparing the results with
experienced intelligence analysis. The system has been implemented by using ESRI
ArcGlS software, World Wide Web (WWW), as well as querying attributes, display data
layers, zooming, and planning.

3
Throughout history, advances in capability have been fueled by innovation. This study
focused on introducing high technology which can be used by the soldier.

High speed mobile broadband is an essential factor in modern society. People have ability
to communicate as well as exploit the capabilities of the latest smart phones. People
require the same technology that powers high speed commercial cellular networks so they
can send photos, video and keel) track of their unit's location. This study was to introduce
latest communication technologies and live tracking systems using GPS and existing
commercial GS M connections.

Special this system was design to collect field information in very efficiency and accurate
manner. Basically this research was concern in the disaster information gathering but it can
be incorporate into any kind of field data collection systems.

The main advantages gained from working with this system are fast clifTusion and efficient
management of geographic information system. it is, in fuct, well known that works are
depending on the ground analysis.

The internet technology adopted! for GIS application has been indispensable in spreading
basic knowledge. The combination of software and data standards realized in this work has
enabled the management of vast amounts of geological, geophysical and territorial data.
1.3. Problem
When consider about the urgent and time sensitive nature of disaster situations it is
compulsory to collect and use spatial in!brmation of the relevant disaster during a short
period ottirnc. This would be achieved in a collaborative effort by all the pal-tics involved
in disaster management process. But there are substantial problem with collection, access,
dissemination and usage of required spatial data for disaster management. Such problems
become more serious during disaster management phase with its dynamic and time
sensitive nature. In other words any problem of delay in data collection, access, usage and
dissemination has negative impacts on the quality of decision making and the quality of
disaster response. In this regard disaster situational reporting system would be much
important to succeed in collecting and sharing such spatial data in relation to disasters

The problem of the study is to examine how far the facilities available in Mobile and
telecommunication technology are utilized for incident reporting and data collection in
disaster situation.

This availability of increased processing power coupled with smart phones that have
numerous inbuilt sensors such GPS positioning sensors, Wi-Fi, Bluetooth, camera,
pressure. temperature, humidity, light and inertia sensors such as digital compass,
accelerometers and gyros, has created a powerlul tool which can be used for geographical
inirmation data collection. In addition many top end smart phones are starting to use
multi-constellation GNSS chips for example the iPhone 4S, iPhone 5 and Samsung Galaxy
Note use a GPSi-GLONASS GNSS chipset. This hardware does not exist in isolation but
benefits from advances in computer science, in particular the emergence of Web 2.0, as
well as the availability of broadband and 3G communication networks. Smart Phone
platlorms such as Android provide an API for developers to write their own software with
additional APIs in Android to utilize Google maps, There are also APis available for use
with Open source maps such as OpenStreetMap.

5
1.4. Significant of the Study
Nowadays, disasters are a serious threatening to human lives and property .Flence,
appropriate management of these disasters has become one of the most notable topics of
human beings in current century. Disaster management process requires precise and
reliable information about the current situation of disaster, existing facilities and sources,
vulnerability, access routes etc. More than 80% of this information has spatial components
of location. There for Gco-spatial Information system(GIS)as a tool to collect, store ,modal
,analyze and display large amount of spatially information layers, support all aspects of
disaster management.

With the purpose of succeed the above intention smart phone is the ideal equipment. Today
smart phones arc becoming the primary computing and communication platform for
peoples daily tasks. Since these smart phones have the functions of installing applications
and provide users with more diversified mobile value added services. Most of these smart
phones are inhuilt with GPS technology(Beaubrun et al. 2007). Since the current mobile
communication follows the development trends of GPS technology, make users can
retrieve location data by using map applications and navigational applications. Hence
mobile application would be a ftasihle route for disaster communication. On this purpose
of field data collecting and real time updating about disasters can be highly improved by
using geographical in!brmation technologies. Since theii this new source of information,
has been found to be especially useful in disaster management.

This paper aims to address the role of Mobile GPS as an integrated application for
thcilitating disaster management by improving field data collection and in-field decision
making by using Android technology.

1.4.1. Issues and Challenges


While data collection via mobile phones may offer particular advantages when compared
with traditional survey and data collection efforts, this is not to imply that such efforts are

6
not without challenges or diliiculties(Miehael Trucano 2014). Some common notable
issues and challenges are:

1.4.1.1. Technology
What technology should we use? What are the minimally viable specifications required for
the devices used in mobile data collection efforts? What sofiware applications are
available, and what are their related advantages and disadvantages? These are often the
first questions that many groups contemplating extending or complementing existing data
collection efforts thi-ough the use of mobile phones often ask. While questions such as

these will (or should) inevitably be posed at some point during the planning process,
leading with them is typically a mistake. It is important that choices around a specific
technology or device not deline the initial scope or conception of the extent to which
mobile data collection efforts might be beneficial and possible. No one technology may do
everything that is required. Where one too] may appear to be a perfect fit for what is
required, it may not work at the necessary scale. Vendors or partners may propose use of
certain technologies or devices which may not be well suited for the specific data needs
and/or data collection and sharing processes of the sponsoring group. Deciding which
tools to use, and which partnerships to develop, may be critical pieces of the puzzle. First,
however, it important to have a laiger pictures in place of what the objectives of a
particular data collection might be, as well the ielevant local context (including key
stakeholder groups). Once that has been established, technology-related decisions can be
made in the service of both higher order goals and on-the-ground realities.

1.4.1.2. Training
While in some instances less training and explicit instruction may be required, because the
tool is being used (a mobile phone) is familiar to respondents and enumerators alike, in
sonic circumstances additional technology-related training and support may still be
required. The adoption of user-centered design principles and techniques can help in some
circumstances to avoid the need for certain types of training. (IL for example, an interface
is easy or even 'inluitive to understand, users may not need to spend much time figuring it

7
out.) That said, depending on the nature of the data collection process and the methods of
data transmission, additional training may well be required.

1.4.1.3. Cost
The costs of designing data collection instruments delivered digitally may be considerably
higher when constructing traditional paper-based technology. In addition, new back-end
technology infrastructure may need to be procured and put into place. Where it is not
possible for enumerators to utilize their persona] phones (whether because such use is not
customary or permitted, because existing phones have insufficient functionality or because
mechanisms for covering or reimbursing related data transmission costs are not in place),
devices may need to be purchased and distributed (and potentially collected once they have
served their purpose). Air time may need to be pui-cliased. (More than a few data collection
efforts by mobile phone to bene lit charities' have foundered because sponsoring groups
have wrongly assumed that mobile operators would be quick to donate free airtime for a
good cause'). Whether or not these costs in aggregate are cheaper than the way things are
tra(litionally done or not - and they often are! - sponsoring groups may have difficulty
estimating and budgeting for such costs on the front end, especially the first time they
engage in efforts of this sort.

1.4.1.4. Security
Digital collection and transmission of data as part of large scale survey efforts carries with
it numerous potential risks and challenges related to data security and privacy that are often
fundamentally different than those posed as a result of traditional paper-based survey
efforts. if stored on devices, data can potentially be stolen or improperly accessed - the
same holds true during data transmission. The use of encryption at both the device level
and during transmission can greatly mitigate such risks, but the use of digital data security
tools, protocols, and good practices, as well as related regulatory frameworks, laws and
guidelines governing the use of such tools, may not be known widely known - or in some
places, even be at hand. Where third party ven(lors or tools are utilized during the mobile
data collection process - something that is usually the case - care needs to be taken to
ensure that ownership, possession and utilization of data collected and transmitted are
clearly articulated. Sufficient mechanisms need to be in place to audit i-elated arrangements
and agreements, and to ensure that penalties for non-compliance are clear and enthrceable

1.4.1.5. Speed and Challenges


Speed of change: If mobile data collection efforts are expected to be repeated over time
(for example, as a part of yearly census or annual planning activities), it should be
expected that some of the enabling technologies may themselves change - as might the
good practice guidelines and regulations related to their use. In some circumstances, this
sort of change may even occur during the course of a specific data collection process itselfi
Technological change often outpaees the ability of planners and policy makers to anticipate
and respond to these changes. Those involved in planning for and implementing mobile
data collection activities would do well to keep this in mind, and should be prepared to
monitor and respond to such changes over time. Planners should try to avoid making a big
bet' on an unproven technology (especially one based on a closed or proprietary standard)
or on single vendor, and should always consider how they may most effectively exit and
transition from specific relationships, tools and standards.

Though there are afbrcsaid challenges has to be addressed while developing a disaster data
collection system, there are possibilities to overcome those challenges.

9
1.5. Objectives
The main objective of the study is to build up a system for disaster incident data collection
using mobile and communication technology. The specific objectives are as follows:

Introducing mobile technology and location based service for field data collection
in disaster situation to overcome the existing paper based data collection and reporting
methodology.

Improve the quality of the data management in field data collection.

To improve the efficient and effective data transfer from field workers to main
station in disaster situation.

4. Develop a mechanism to get the disaster incident data for decision makers.
1.6. Methodology

1.6.1. Analysis
Development of a mobile application for disaster field data collection consists of Android
mobile apps and web interface with fully stored data retrieve functionality. This mobile
application includes the location data such as province, district, Division sectaries division
and latitude and longitude. And also affected data in numbers such as affected location,
affected people and each and every data required for disaster management process.

The mobile application has capable to acquire real time GPS data with situation incident
related photograph and has capable to store each and every data in its local database
.Application has background service to cheek availability of internet facility of the real
location and if connection is success it will automatically transfer the data into database
server without any user involvement.

1.6.2. Design and Development of Application


The mobile application is going to develop using a most popular Android development tool
call Andi-oid studio. And programming language is JAVA. The integrated web application

is developing using PHP and HTML. The relational database is MYSQL. Web server is
apache.

1.6.2.1. Overall System Architecture I)esigu


The system architecture design is such that it involves two major entities: the mobile
application and server application. The mobile application should be able to send and
retrieve data from the server.

1.6.2.2. Server software application design and database integration


The server application needs to be installed and integrated with database. Once the data is
received by the server, it should also be used to update the database. The mobile
application should have an authentication to connect to the server. The database
connectivity should be managed at the server end only.
1.6.2.3. Mobile (client) Application Design
The mobile application is the most important component of this research project. It

exhibits the functionality discussed in Chapter 1. Also we tried to address as many as


possible requirements that were retrieved from the disaster management officials by their
experience during various rescue operations.

1.6.3. Configuration Development Environment


The deployment of the application needs some resources to he configured. Most
importantly an Android Smartphone with GIRS (preferred 3G), Android OS version
4.0.1 and later versions, inhuilt GPS, total storage of 14 MB(internal storage 9.85MB and
external storage 4MB ). It can consume additional storage as per usage. The server and
database should be up and working 24/7 to accommodate information retrieval from
mobile application and vice versa

16.3.1. Configuration of Resources


The following resources should he configured to fully deploy and test the application

Android phone

Network /Internet connectivity

GPS reception

Server application
Database server

1.6.3.2. Build Test Cases


The below criteria is devised to test the mobile application. It cheeks the application
perfoimance by testing its accuracy and time consumption under various networks. It
checks the application in dillerent field conditions. The memory and battery consumption
and lastly usability testing to check the application from user's point of view is also
important.

Software Testing

Location Accuracy

12
Time consumed
GPS
Internet (Map loading and information display)
Battery consumed
Memory consumed

Network Access

3G/2G/Wi-Fi
Field Testing
Dense forest
Urban area
Cloud cover
Humidity
Hilly Terrain

Usability Testing (User Interface and Usefulness)

Field Workers
Random Users

1.6.4. Architecture
An overview of the architecture for the Geospatial Data collection system is shown in
Figure 2 The web application runs and is hosted on an Apache web server and the disaster
information and is stored in a MySQL database on that server. When a user logs into the
web application, data are retrieved from the database and displayed to the user. The
disaster management web interface uses a responsive layout to adapt to the screen size of
the device for each user.

13
Satelite -

VV
GSM
--
Network ArcGIS

Ok 1J-J Web
Server

Collection of
Disaster ! API
Information interface

Figure 1.2: Proposed architecture for geospatial data collection developed by author

1.7. Thesis Structure


The research work is organized into the following chapters. Chapter 1, Introduction
explains the need and purpose of the research. It consists of background of work,
motivation and research identification. Chapter 2 summarizes the various research efforts
already done in the field. Subsequently in Chapter 3, the research plan and methodology is
discussed. It includes the details of the interview and discussion with rescue workers. It
also lists out the analysis made and the requirements extracted, to be developed as
functionality in the mobile application. Design and implementation of the Android
application is presented in Chapter 4. Results and discussions are explained as part of
Chapter 5 while Chapter 6 presents conclusions and recommendations for further work

14
Chapter Two
DETERMINING USAGE OF MODERN TECHNOLOGY FOR DISASTER

2.1. Disaster Management with Modern Technology

The number of disasters, both natural and technological, has been climbing over time. Data
on all categories(other than terrorist attacks) from the International Disaster Database, EM-
DAT, show a steady increase in the frequency of natural disasters during the past 35 years,
with almost as many events occurring during the past five years as in the whole of the
previous decade. According to the EM-DAT database, there were on average 428 disasters
a year between 1994 and 1998, but the annual average jumped to 707between 1999 and
2003.Countries of low human development (as defined by the United Nations) suffered the
biggest increase in the occurrence of disasters. Until the 2004 tsunami, the average death
toll had been declining (from 75,000 a year to 59,000 a year in those two periods
respectively); but the numbers affected by homelessness and displacement increased
markedly, from an average of 213 million year to 303 million a year.

Amcricas

FIurupc 5 38 230,700 153


2' 22$I

Table 2.1 :20 15 first semester natural disaster occurrence and impacts

Source:EM-DAT" International Disaster Database, accessed 7/09/15.

15
Oceania

Europe

Ava
Mod

Amelcas -

Air Hd

U 10 20 30 40 50 60 70 80 90 100%

iOamages allo. Total affected allo.Deaths iOccurrence

Figure 2.1: Graphical Comparison of disaster occurrence and impacts

()ceureme No. Deadys \o. Total affected Economic damages (t'SS)


Flood .j Storm Landslide Earthquake Drought w Volcanic activity w Extreme temperature w Wildfire

Figure 2.2:2015 qurter natural disaster occurrence and impacts: CRED Research Institute
Health & Society (IRSS)

Over the past decade, there has been an alarming increase in the frequency and also in the
intensity of disasters in various parts of the world. The Haiti earthquake, Katrina hurricane,
Indian Ocean Tsunami and the Nargis cyclone have been major disasters over the last
decade. These disasters force mankind to think of ways to cope up with such calamities.
The increased number of affected people and spatial extents of disaster impact due to
disaster and the high economic losses from natural disasters are a cause of great concern.
The economic growth of the affected country slows down and takes decades to recover
completely.

Especially the developing and under-developed countries take a longer time to recover
from such losses. This calls for enhanced methods and techniques for disaster
management. Every country has to realize this need and think of better ways to manage
disasters. It is true that natural disasters occur at a scale that causes much destruction and
many losses which are unavoidable. Even though scientists and researchers work
constantly on predictions and weather forecasts but sometimes they do fiil to foresee the
impact a certain disaster would have. Sometimes they are caught totally unaware by such
calamities. But management of rescue and relief operations can be planned before-hand
and executed at the time of disaster. The disaster management techniques, even if already
existing, need to be constantly revised and updated. This is because new technologies keep
coming up and should be leveraged for disaster management to produce profitable results.

Doner and Yomral1011lu(200$) iiiade an assessment of using MGIS (Mobile Geographic


Information Systems) as a tool for acquisition of geo-data. They described and discussed
anMGIS developed for field data collection that also utilizes GPS. It resulted in a
noticeable gain in efficiency, accuracy and rcdLlced cost while meeting the project
completion time. It designated MGIS as an appropriate tool for field data surveys showing
the kind of efficiency and accuracy that would be expected from a disaster management
application.

A project worth a mention in this aspect is Sahana Eden. It was initially conceptualized as
Sahana Software and developed by the IT community of Sri Lanka to help in the relief
efforts after the 2004 Indian Ocean Tsunami. This software package evolved to be known
as Sahana Eden. It was supported by a voluntary community that includes disaster
management practitioners, academicians, students and companies. The communities
promoted customization of the software by making it available as free open-source
software, with related standards. The project was a successful implementation of a disaster
management solution to help manage relief organizations, people involved, assets and

lw
inventory. The project also used maps to make assessments and bring about awareness of
the situation. This set a perfect example and motivation to think of a technology-based
solution to help improve the way disasters are addressed.

Karnatak (2012) presented use of mobile application for flood disaster management in
Assam, India. The mobile application developed under this study used Windows as a
platorm An Aiidroicl application to support flash flood disaster response management in
India for application development. The data from field to control room was transferred
through an XML message containing different types of data including geo-location and
images. The XML-based data transmission from mobile application to server proved to be
an effective mode ol communication. The data received from mobile device was integrated
in Web-GIS application in a real-time environment and other flood specific GIS data were
also accessed from remote servers.

2.2. Role of Information in Disaster Management


It is very essential to identify the importance of a strong relationship between the
technologies applied for disaster management and the needs of disaster response
representatives.Kevany (2005) unfolded interesting information through his own
experience in the disaster management operations that took place after the World Trade
Center mishap on 00/11/2001 in New York. This came from an observation that the design
and deployment of technology to serve disaster management, was perk)rrned by
technologists without any participation of end users. The technologists lacked field
experience in disaster management and vice versa. To merge the knowledge of the two
was critical for effective utilization of the technology. This particular disaster commonly
referred to as 9/I1, had a great impact on the way geo-information is used for disaster
management. The author emphasized the relevance of geo-information i.e. location
information. Most importantly the location of disaster impact, response teams and
resources should be known. An extensive list of geo-in formation data requirements was
provided in the paper. It also discussed the requirements for geo-information management.
Preparation of information is essential for relief management.

18
Tsai and Yau (201 3) discussed three problem scenarios that require adequate and timely
information during a disaster response and recovery mission: (a) inadequate escape
guidelines for people, (b) incomplete geographical information for relief workers and (c)
insufficient on-site information for disaster managers. This research work signified the
importance of real-time exchange of both on-site and off-site information for disaster
management. It involved three entities in the example scenarios: rescue/relief workers,
victim and disaster manager. On-site information was required by the relief workers to
plan evacuation routes and pertorm rescue operations whereas off-site information was
used by disaster managers fbr better decision-making and management. For example
disaster managers retrieved location information from relief workers and plotted them as
point locations on the guidelines maps. As soon as they received emergency assistance
requirement from victim, they could locate a rescue worker closest to the spot and convey
the information. This highlighted the need for simultaneous execution of the on-site and
off-site operations resulting in updated information at both ends and prompt emergency
response. A mobile application was designed that displayed guidelines for on-site escape
and rescue. Successful results were achieved afier testing the integrated information on a
mobile platform in a simulated scenario. Participants enacted as victims, on-site rescue
workers and off-site disaster managers. Disaster managers updated current information as
received from on-site rescue workers. Victims saved time in performing self-evacuation
with help of emergency guidelines received from off-site disaster managers. The study
was conducted for the Typhoon disaster type, but indicated applicability to other disaster
scenarios.

2.3. Disaster Communication


According to the definition of Susan Bulgawicz and Charles Nolan( as cited in Sung 2011),
a disaster is "An event whose timing is unexpected and whose consequences are seriously
destructive or simply an unfortunate event." Normally. there are four distinct phases of
disaster management which is namely, mitigation, preparedness, response and recovery
(Yodmani& Hollister, 2001). In the four stages, with different pulioses and between
different agents, communication strategies and principles may differ. Basically, during a

19
disaster time, information sharing, collaboration and coordination are very important for
the response and recovery stages.

When discussing about disaster communications, both Communication Studies and


Emergency Management scholars arc aware of and demonstrate interests in some facets.
For instance, technologies promise to facilitate discussion about mitigation efforts,
identification of potential hazards, connectivity between response organizations of all
types, warning messages to the public, and diffusion of important disaster information
(Fischer, 1998). After the 911 attacks and 1-lurricane Katrina U.S., many researches and
reports related to disaster communications and disaster managements mechanismin the
U.S. Literatures and reseaichcs are often refer to the role of mass media during disaster and
the media reportages of disaster, also the communication plans about disaster
managements.
Especially 1-Iadclow&Haddow( as cited in Sung 201 1)in their book"Disaster
Communication in a Changing Media World" try to build a framework about how does
disaster management personnel interact with media, and linked media to a public
information delivering part. In the framework, it show that communications are necessary
for assessing damage and need; collecting information on supplies and other resources;
coordinating rescue and relief activities; accounting for missing people; and motivating
public, political, and institutional responses (Yodmani& Hollister, 2001).
The disaster communications have changed from a conventional thinking "command and
control' type to a highly decentralized and perhaps multi-node network(Sung, 2011),
effective communication links between emergency operation centers, broadcasting
systems, front-line responders and affected communities are critical in the aftermath of a
disaster. Information and communication technology (ICT) has expanded the reach of
disaster sociology and brings new challenges to the empirical study about disasters (Palen
et al., 2007).

After the September II attacks in 2001, Asian tsunami disaster in 2004, and Sichuan
earthquake in 2008, there has been a burst of online activities from netizens across the
world, not only have more people turned to the net to receive the most updated news, but

20
the Internet has also played a large i-ole in coordinating logistical efforts, raising funds,
expressing views and locating missing people. In Taiwan, the Morakot Typhoon in 2009
showed the online social networking can be influential in disaster communications. During
the disaster, web users began reporting the real-time situation on the forum PTT, one of the
most popular Internet social networks in Taiwan, and a group of internet users from the
Association of Digital Culture Taiwan established an unofficial Morakot Online Disaster
Report Center tor coordinating information. During the disaster, these social networking
sites help a lot to instantly update infrnmation, even earlier than government and mass
media.
Feedbacks, sharing and active search behavior have become influential for disaster
management. New genres of websites seemed to be developed for people to search more
disaster information such as some sites providing information on missing persons. The
Google Crisis Response team uses its strength to offer tools or content to assess the
severity and scope of a disaster. The tools including Google Person Finder which connects
those seeking information about loved ones, and Google Resource Finder, which helps
locate medical facilities and other emergency services. Google also provide high-resolution
satellite imagery to crisis responders and monetary donations to non-profit organizations
that provide relief services. When mobile also had become a device for surfing internet and
the SNS software are built in as an app on Smartphone, it has more functioned as a
convergent service for multi-usages, mobile apps has become tools for deliver an alert or
other notifications.

2.4. Mobile Technology


Mobile technology has shown a considerable impact on society over the past few years.
Gradually, this technology has become a part of every person's life and is the easiest mode
to deliver information. People do not get tired of experimenting and exploring new apps
and developers leverage this advantage to create and innovative and challenging apps.
Ditierent operating systems are available lir dil'ftient mobile devices. Google's Android,

Apple OS, Blackberry, Symbian and Windows are all available for
development(Trenholm, 2015).

21
Advances in mobile technology and wire- less data communication services have made
these mobile devices increasingly reasonable and more widely available to the public. As
well, remarkable improvements in the ability to transmit data have aIlOWe(1 mobile devices
to compensate for many of their computational constraints (Qian Wang & Ralph Deters,
2010), resulting in mobile phones and tablets has become the primary computing among
the rapidly growing number of users worldwide. Recent estimates have placed the number
of worldwide mobile subscriptions to he nearly 7 billion, which is equivalent to about 96%
of the world population (Itu .2015). However, as many people own and use multiple
mobile devices, the actual number of mobile users is smaller but still significant at 4.6
billion, which is approximately 65% of the world population(Sung, 2011). Mobile
technology is becoming increasingly integrate(l into our society, and many of the unique
features of mobile devices present new opportunities in aiding the disaster management.

2.5. Mobile Development


Another aspect to consider during the development of mobile applications is the debate
between native mobile applications and responsive web applications for mobile devices, as
each option presents its own advantages and disadvantages. Native mobile applications are
developed for particular mobile platforms such as Google's Android smariphones and
tablets and Apple's iPhones and iPads and are installed directly onto the devices. Some of
the advantages of native mobile applications (Anon, 201 3)include: the ability to operate
without an active internet connection; direct access to functions and latures of the mobile
device such as the camera, GPS, and list of contacts; the ability to incorporate gestures for
touch scrcens and use of the device's notiflcation system. The biggest disadvantage, how-
ever, is that each mobile platform requires its own development tools and process. Android
applications use the Android Standard Development Kit (SDK) and are written in the Java
programming languagc( Ma, Gu, & Wang,2014), they must write separate code-bases and
use multiple SDKs for each potential device the application may have to run on.

Web applications, on the other hand, are websites on theinternet thatmimic the look and
feel of native applications, and are accessible through the web browser on the mobile
devices. They are typically written with web programming languages such as PHP and

22
JavaScript use formatting languages such as 1-ITML5 and CSS and are insta1led' onto
mobile devices by creating a bookmark to the website on the home screcn(Trenholm
2015). The biggest advantage is that the developers can create a single web application and
automatically have it run across many different devices, making it easier and more
manageable in terms of improving existing features, implementing new functionality, and
maintaining the code for the application. As well, data can be stored on-line in a database
such as MySQL and any calculations or other functionalities can be performed server-side,
which reduces the amount of memory, storage, and processing power the application
requires from the device itself. The disadvantages of web applications are that they require
an active internet connection, and they rely on the browser to support the web technologies
used by the application. Many older hiowsers do not fully support the features and
functionality of HTML5 and JavaScript. Nonetheless, advances in mobile technology and
the capabilities of modern web browsers makes vebapplications a more feasib]e option
than previous technology allowed. For example, the I-ITML5 Geolocation API now allows
web applications to re- quest GPS information from the mobile device directly, whereas
previously only native device-based applications had that capability(Monzavi & Darwish
2014). Of course, with enough resources a developer could feasibly create bothweh and
native device versions of their mobile applications if they felt it was necessary and
appropriate to do so. Ultimately, the decision to develop either a web application or a
native device application depends on the needs of the users, the goals of the developers,
and the intended purpose of the application.

But considering all the facts if someone needs to make use of device specific hardware or
needs very fast and accuracy will do better with the native solution (Kushwaha &
Kushwaha 2011).
SEEL Cost -
flNATNEA

..:
MENNEN
'. Mostoni incestntnnt

Portability

Maintenance
U lonpion to .neintair and dow to 10P oat hngto Refalivoty ,no,pIo to nioiniain wdh natant opdatnn

Slob itui, c,alJi dow to ii:,,,, 011.1K' Cl JpiriiIiod Ira,,. dcstcp radiAtor
Speed of Delivery .,t l, it tnntoiq till,1000 ,t000lri, tooqolton ii IN of ttot,nC

Perormance R tiar llyw,thqotrk load g ndted to Plo - iotornt rolenca towolts in tlower toad and 'e,ponn.

User Etcperience ri I ,,iinwotr. loot


dookOifi 00 St
V.

lnte9rated Device
ln,eqaware a o, aW VaryIottrtddecicnd1to40en
Features

Pt-rNctf too

Offline Features - -- 5t sn for onotoanaw, - Liroyd ofitno supped

R
0
Future Proof 1.0 Ct ,r,posniblo to adopt dootC,trnojiion
U

Figure 2.2: Comparing Native app with HTML 5

In 2013, two significant pieces of mobile industry research highlighted a strong preference
for native apps among users. Equation Research surveyed 3500 Smartphone users around
the world about their mobile experiences. An astonishing 85 per cent of respondents
preferred native apps because of speed, high-quality interfaces, and platform features, that
even the best of HTMLS developments cannot provide (Anon 2013).
Meanwhile, the widely-reported Bite Interactive survey4 revealed that 66 percent of
iPhone users and 63 per cent of Android owner's prioritized native apps over
HTML5.They were well aware of the value of making full use of Smartphone capabilities.
Only 19 per cent of overall respondents were indifferent to the distinction between native
and HTML5 (Anon 2013).

Now is an exciting time for mobile developers. Mobile phones have never been more
popular, and powerful smart phones are now a regular choice for consumers. Stylish and

24
versatile phones packing hard-ware features like GPS, accelerometers, and touch screens
are an enticing platform upon which to create innovative mobile applications(Meier 2010).

And also according to above author's suggestions, Android hardware will be designed to
tempt consumers, but the real win is for developers. With existing mobile development
built on proprietary operating systems that restrict third-party applications, Android offers
an open and equal alternative. Without artificial harriers, Android developers are free to
write applications that take full advantage of increasingly powerful mobile hardware. As a
result, developer interest in Android devices has made their 2008 release a hugely
anticipated mobile technology event.

Built on an open soLirce framework, and featuring powerful SDK libraries and an open
philosophy, Android has opened mobile phone development to thousands of developers
who havent had access to tools for building mobile applications. Experienced mobile
developers can now expand into the Android platform, leveraging the unique features to
enhance existing products or create innovative new ones(Meier 2010).

According to above discussion and findings it is very vital to discuss the feature in the
Srnartphon e.

2.6. Featu res, Constrains, Consideration in Mobile Technology


Some Of the unique features of mobile technology include their portability, location and
spatial awareness, built-in cameras, touch screen inter- faces, and remote data access.
Many mobile devices are small, thin, and lightweight, making them easy to carry and hold.
This portability allows smart phones and tablets to be used in places where other more
cumbcr- some devices cannot. As well, most smart phones and tablets have a global
positioning system (GPS) built into the devices, which allows for satellite navigation for
the user. and dynamic maps to display the user's location in relation to nearby l)laces of
interest. An internal gyroscope also allows the devices to respond to changes in travel
speed, direction, and orientation. Additionally, built-in cameras allow for pictures and

Vi(leO to be recorded easily, and touch screen technology allows for new ways for users to
interact with the interfaces of the devices. Finally, mobile devices with data services allow

25
for near instantaneous access to and sharing of information at the touch of our fingers.
Along with the unique features that mobile devices offer, there are several unique
constraints and challenges that must be considered for the development of any mobile
application. The authors of(Qian Wang & Ralph Deters 2010) and (Luca Chittaro 2006)
explore some of these challenges, which include data and network issues, physical device
limitations, and user expectations. The issue of network load and wireless spectrum
allocation for data services is discussed in (Qian Wang & Ralph Deters 2010). The authors
explain that with the increase in the number of mobile devices being used, there has been
an increase in data traffic and consumption of wireless bandwidth. Since there is only a
finite amount of the wireless spectrum that is usable, telecommunication companies and
providers are being stretched to their limits and must focus on improving their data
services to meet the increasing demand. There are several physical constraints that affect
mobile devices, as covered in (Qian Wang & Ralph Deters 2010) and (Luca Chittaro
2006). Almost all of the physical constraints are a result of the size limitations of the
devices. To be small, thin, and lightweight for portability, mobile devices must use smaller
batteries and less powerful hardware in comparison to larger devices such as desktop or
laptop computers. This means there is less memory and computational resources available
on the devices, which affects their ability to run more complicated applications or tasks.
Other physical constraints itielude smaller screen sizes; limited screen resolution, limited
processing power, and variations in inter face input methods such as small keypads or
touch screens. The final and perhaps the most notable challenges are those based on the
user expectations of mobile devices and applications, as discussed by (Qian Wang&Ralph
Deters 2010) and (Luca Chittaro 2006). Users expect that applications on mobile devices
will respond to their actions and requests accurately and in a timely manner, such as when
taking a photo, using the GPS to navigate, or changing the orientation of the device. They
also expect a certain level of interactivity with mobile devices, such as the ability to zoom
or scroll when viewing content. Finally, usei's expect applications to be user friendly.
In addition to these challenges and constraints, there are some otheraspects that must be
considered for mobile applications. ln(Volker Paelke, Christian Reimann, &Waldemar
Rosen- bach 2003), the authors address some significant factors that should be considered

26
when developing mobile applications. The flrst is that the way users input information and
interact with applications on mobile devices differs significantly from desktops or laptops.
There is no standard input method such as thekeyboai-d, mouse, or track l)ad. Input
mechanisms on mobile devices can include real and virtual keypads, touch screens, and
even voice commands, and even these methods can vary greatly between the different
models of mobile devices. Several other considerations when developing mobile
applications involve the context of use, specifically the auditory environment, the visual
environment, and the level of attention. Desktop and laptop computers are often used in
controlled environments, whereas many mobile devices are used in settings where the user
has limited control of their surroundings. Sound use may be limited if the mobile devices
are used in public or outdoor settings, where outside and background noises can prevent
the user from hearing the intended sound. For the visual environment, mobile devices may
be used in a variety of lighting conditions, ranging from total darkness to bright sunlight.
Finally, the level of attention that users can devote to the applications on their mobile
devices may be limited due to interruptions from the environment or other activities
competing for the user's attentioft

2.6. 1. Location Based Service


Location Based Service (LBS) is emerging as a killer application in mobile data services
thanks to the rapid development in wireless communication and location positioning
technologies. Users with location-aware wireless devices can query about their
surroundings (e.g., finding the nearest restaurant or all shopping malls within 5 miles) at
any place, anytime. While this ubiquitous computing paradigm brings great convenience
for inlrmation access, the constraints of mobile environments, the spatial property of
location-dependent data, and the mobility of mobile users pose a great challenge for the
provision of location-based services to mobile users. Over-view of Location Based
Scrviccs.A Location Based Service (LBS) is a mobile application that is dependent on the
location of a mobile device, like mobile phoie. Virrantaus, K., Markkula, J., Garmash, A.,
Terv.iyan, V., Veijalainen, J., Katanosov, A., and Tirri, H, (2001)defined LBS services as

27
follows: "Information services accessible with mobile devices through the mobile network
and utilizing the ability to make use of the location of the mobile device Open Geospatial
Consortium" defined LBS service similarly:"A wit-eless-IP service that uses geographic

information to serve a mobile user, any application service that exploits the position of a
mobile terminal."
A Location Based Service (LBS) is an information and entertainment service, accessible
with mobile devices through the mobile network and utilizing the ability to make use of
geographical position of the mobile device. A LBS services can he used in a variety of
contexts, such as disaster(Fajardo & Oppus 2009), health, work, personal life(Braun et al.
2013), etc. LBS include services to identify the location of a person or object, such as
discovering the nearest banking cash machine or the where about of a friend or employee.
LBS services include parcel tracking and vehicle tracking services. LBS have two major
actions, that is:
Obtaining the location of user
2 Utilizing this infmiation to provide a service.
These 2 actions are used to answei' these 4 questions (below) for a mobile user in a new,
fast, and more accurate way, to fiini the basis for LBS:
Where am I...?
2 Where is the nearest ...?.
3 Where is my ..?,
4 Flow does I get there?
LBS services can he categoi-ized as triggered LBS services (push services) and user-
requested LBS services (pull services). In a triggered (push) LBS service, the location of
user's mobile device is ietrievcd when a condition set in advance is fulfilled. For example,
a call to emergency center can automatically trigger a location reqLlest (D'Roza&Bi!chev.
2003).

And also above author explain in a triggered (push) LBS service, the location of user's
mobile device is retrieved when a condition set in advance is fulfilled. For example, a call
to emergency center can automatically trigger a location request. Advertisement messages
can be delivered to users who enter a specific area in a shopping mall, and warning

28
messages can be delivered to users who are in the area where weather conditions will
change (e.g. hurricane, rain). In a user-requested (pull) LBS service, the user decides
whether and when to retrieve the location of his/her mobile device and use it in the service.
User-requested LBS service can involve personal location (i.e. finding the current location

of the user) or services location (i.e. finding the location of the nearest restaurant or bank).
Navigation and direction system is an example of pull LBS services (D'Roza&Bilchev,
2003).

2.7. Android Development


Considering Android as a target platform for application comes from the review of various
works using Android technology. The Android SDK allows application development with
great ease. There are many inhuilt features and tools in an Android device which can be
integrated and programmed to be used as and when required from within the application.
Locatioii-hased services are described as information services depending on user's current
location and are being used judiciously in every aspect (Jiang& Yao, 2006). Be it traffic
information, advertisements and promotions depending on locations or knowing amenities
nearest to one's own location. Such services can be leveraged for disaster management
scenarios. They are implemented in mobile devices through A-GPS (Assisted GPS)
technology. This technology integrates the location information through mobile network
with that retrieved from the dcvices GPS. This helps to quickly know location, consumes
less battery, has better coverage and can, in some cases, be used inside buildings
(Singhal&Shukla, 2012). The application can also make use of camera, compass, calls,
SM S. email lhcilities and the developer can think of a number of ways to create features in
an application that utilize these inhuilt thcilities.
Geographic information services through mobile can help emergency response teams to
identity areas under threat or impact of disaster. Mobile GIS information combined with
GPS and satellite imagery can help retrieve important results like quick execution of

evacuation l)laflS and tracking of emergency response vehicles (Tsou& Sun, 2006). Quick
reporting of incidents and information is a critical task and can be accomplished through
Smartphone applications. A disaster management application is helpful if it captures

29
important data like location of injured and non-injured people, images of the damaged
area, weather up(Iates for the particular location, alaniis and alerts, quick access to maps
and location-based services (Richter &Hamrnitzsch, 2013)

2.8. Related Works in Android


The Google Play Storc, a virtual marketplace that provides services and applications to
Android devices, presents a number of applications upon searches by the keyword
'ernergcncy". Gomez (2013) analyzed 250 emergency-based Android applications. For
each application, the data (descnption of' the application, version of Android targeted,
price, rating, and application technology) was collected. These applications were dedicated
to either (lCteCtiofl of emergency, notification or management. Depending on the target end
users of each application, the applications were divided into categories to allow further
analysis. The categories were:

Victim (59/s)

Professionals Rescue Team (14%)

Rescue Voluntary (1 4%)

Witness (7%)

General Public (6%) This is for those not affected by the disaster

The study and review of these applications resulted in the conclusion that more than half of
these applications were designed for victims. There were fewer applications addressing
rescue workers to support in rescue operations. Also the major features of the applications
were studied. These included:

Location data access (Fine, coarse or mock location)

Communication resources access (Bluetooth, internet access)

Communication tools access (SMS, email, phone numbers)

The location service was calculated to be used by 81.2% of the applications. 106 apps use
GPSsensors whereas 81 apps rely on the network communication. Most of them combine
both technologies. This is an important consideration since GPS does not work without sky
visibility. Through this research work an application was proposed for better organization

30
of relief activities (Gorncz, 2013). The study also considered the possibility of using
internal sensors within device for example shaking the device to raise an alarm and
changes in user position. The framework was designed to work in different modes (victim
mode, volunteer mode, witness mode and citizen mode) to target different needs. This
study revealed the scope of experimenting with application development in the context of
disaster management by targeting them for specific end users.

Palmer (2012) proposed a framework to help overcome the challenges in the domain of
disaster management. RAVEN - a framework to construct an application was provided
with the utility to collect data using smart phones. The framework was built with the idea
to allow developers to construct a user interface and define a schema at runtime. The
aspect of technological advancements in the field of disaster management was also given
importance. Technology can help manage the operations and can also act as a networking
channel. The framework allowed defining a schema for a structured data store at runtirne
and genel-ating a user interface to edit instances of that schema on the mobile devices.
Developers could quickly create data-oriented applications on the phone itself in a short
span of time. A "People Finder' application using this framework was also implemented.
To he able to compare and contrast the development cffirt required and the usability of the
application, theapplication was developedboth by using a standard Android
implementation and by using a framework implementation.

Standaici Android Implementation

Standard Android development tools and practices were used by application developers to
develop the People Finder application. This implementation consumed around 3500 lines
of code. This implied that this kind of implementation would require experienced
application developers to complete the task and take time for completion. This contradicted
the fact that rapid application deployment is required when disaster strikes. l-lence the
author considered another implementation as well.

31
Raven Implementation

This implementation was entirely done using the mobile device. It used Schema Creator
application to construct a schema which is not visible to the user but used internally to

create the database. This enabled an edit-user list with a simple user interface similar to the
one developed using Android to he created on the fly (Palmer, 201 2). The paper then made
a comparison between the two approaches and concluded that time consumed to develop
the application using the Raven framework was lesser than the one using the standard
Android tools. Also the framework implementation required just a srnartphone. Thus this
framework offered rapid application development in case of disaster.

Asif, in (2012) presented a framework through smartphoncs for disaster management


tocope with mitigation activities post disaster. A smartphone application was proposed to
enable information gatheriiig and retrieval by the general public and decision-makers. This
would help in the rehabilitation and rescue processes involved in disaster management.
This framework allowed data collection from the disaster struck areas even in offline mode
i.e. when the cellular network is unavailable. The application was able to transfer data to a
central database through a web application. This data resided on a central database and
used for further analysis.

Similar to lndia"s problem of absence of an efficient technological disaster management


system, Fajardoand Oppus (201 0) discussed the need for such a system in The Philippines.
An Android application named MyDisasterDroid was developed for improved co-
ordination in relief and rescue activities. Geogi-aphic locations were entered by the user
through the application interface and stored in the application database. Paths between
these locations were calculated with a travelling salesman algorithm while genetic
algorithms were used to decide the optimal path. The application interface consisted of two
views: the map view and the list view. While the map view showed the locations overlaid
on a Google map, the list view showed the list of people who needed help and their
locations. The application displayed an optimal route among the locations with a single
button click. The user could prioritize the routes either by closer location or the route with

n
32
more number of people in need. But the routes did not address the safety and concerns
particularly of the rescue workei

2.9. Dealing with Disruption Communication


In disaster-struck areas, there is an adverse effect on communication infrastructure due to
congestion or physical damage. Not many applications address this issue or provide ways
toovercome it. Oppcoms (or opportunistic communications) were suggested byGorbi I and
Gelenbe (2013) as a method of information exchange when mobile communication is
unavailable. In this approach, GPS and Bluetooth were used to exchange messages at close
ranges and carried over multiple hops in a store-carry-forward manner. Also a model of
communication through aerial wireless technology was discLlssed by Shao (2011). It
proposed a BTS (Base Transceiver Station) to he installed in an air crafl. This BTS acted
as a temporary aerial base station. One such base station could span a large area thereby
providing network coverage.

Eleiche, M.A. and B. Markus (2011) discussed the importance of mobile devices in
acquisition and processing of geospatial data and designing mobility applications. To
enable users to pertoiii gcospatial functions in an offlinc mode, a conceptual stand-alone
framework was proposed. This framework was devised to provide spatial functionality in a
mobile device, independent of the communication network. The proposed solution was to
store the objects of interest (images or data) in the mobile device memory instead of the
server. These objects of interest once accessible from the mobile device could he used lbr
processing and analysis.

As soon as the relief and rescue work is initiated in disaster-struck regions, it also becomes
inevitable for the communication network to recover since it has a prime importance in
such situations. Smartphones have the privilege of being able to connect to different
networks such as cellular network (3G. GPRS, EDGE) or Wi-Fi. These devices provide
high utility in different kinds of emergency situations. A study by Farnham et al. (2006)
revealed that cell phones network did recover quickly after the Hurricane Katrina disaster
(Farnham, S., E. Pedersen, & R. Kirkpatrick,2006). Thus it would be a wise decision to

33
implement an application in such a way that it shows usability in absence of network
communication and quickly notify of available networks to perform tasks that need
network access.

2.10. Mobile Data collection


Mobile Data Collection (MDC) is the targeted gathering of structured information using
devices such as smartphones, PDAs, or tablets. According to Jung (2011) In the last few
years, in addition to continuous impi-ovements of earth-observation and web mapping
techniques, the increasing use of new sources of geo-inlhrmation based on new mobile
technologies has emerged. This has created insights and opportunities into the mechanisms
of sudden onset crisis related data collection, analysis and mapping.
And also author discussed that the humanitarian community also recently discovered that
mobile phones are useful tools for collecting data in the field. The arrival of devices
allowing geo-loealization of data collected also raised interest in the humanitarian
community for new technologies such as mapping SMS incident reports or SMS based
data collection. As a result, an abundance of mobile data collection applications and
initiatives appeared in the last seven years in the humanitarian and early warning field.
Mobile Data Collection Systems (MDCS) ask questions that are answered on mobile
devices, therefore requiring two-way communication, either immediately or with delayed
synchronization ol data. It is more than simply sending hulk SMS to a targeted
population, and different from subscription information services that provide alerts such
as the Tsunami Early Warning System and The Australian Early Warning Network.
Mobile data collection applications arc often used internally in an organization, customized
to fit with existing organizational processes. This may mean using services or applications
that are outside most people's day-to-day experience with mobile use.
MDC differs from the crowd-sourced data aggregation paradigm popularized by tools such
as Ushahidi. Data aggregators collect unstructured data found as posts to services such as
Twitter, Facebook, email, and SMS, and they mine this data for information. By contrast,
mobile data collection systems run designed surveys which collect specific information
from a target audience. The audience can be either organizational staff trained to conduct

34
surveys/assessment or the target population being studied can be surveyed directly via
their personal mobile devices. In either case, the specific questions and structured

responses can be important to rapidly collecting information deemed essential to an


emergency response (Jung 2011).

Mobile technology can be used to improve the efficiency of data collection processes
(Hameed, 2003). The use of mobile phones in data collection provides the benefit of quick
data processing since the data is in digital form at the point of collection. Users of mobile
phones have also become familiar with mobile-based applications and do not require
advanced IT skills torun them.

Mobile-based applications can be built on top of mobile development platforrnssuch as


Java ME, Android, .NET CF. Adobe Flash Lite, Symbian and Apple iOS.
Galavas&Econornou (201 3) performed a comparison of four popular plattuiiis: Java ME,
Android, .NET CF, and Adobe Flash Lite.

Galavas&Econoniou (2013) found Java ME to be the dominant mobile-software platform


with respect to its installation and customer base. The "write once, run anywhere" axiom of
Java however does not apply for Java ME since developers have to target a particular Java
SpecilThation Requests (JSRs) set. DilThrcnt devices may have different JSR sets leading to
device fragmentation. This forces a developer to have to compilc an application separately
for each device with a different JSR set. .NET CF (Microsoft, 2014) is designed for
applications on Windows Mobile and is a subset of Microsoft's full dot NET platform. It is
comparable to Java ME with respect to providing a managed runtime environment, rich
libraries and components for reuse. Using a runtime system for intermediate code reduces
execution performance.

Flash Lite (Adobe, 20 14) is a proprietary technology of Adobe and is popular as a


multimedia and game development platform. It is a good choice for a graphics-intensive
device and PDAs and has the benefit of rapid development and also offers rich media

35
support (support for images, video, and sound). Flash Lite has relatively poor graphics
performance, partly attributable to the complex processing required for vector graphics.

Google launched Android (Google, 2013) in the year 2007 with the intention of advancing
open standards for mobile devices. Android is an Apache free-software platftwm with an
open source license and is based on Linux.

2.11. Basic Components of the MDC's


According to Jung (2011) the author discussed the there are a few components that are
common to all MDCS:

l Many mobile devices are used for data collection. Each MDCS supports a subset of
mobile device technologies. The most simple hardware 1-equirement is plain SMS. More
complex forms are built on Java or a srnartphone platform such as Android Mobile. Some
MDCS can support multiple mobile platforms for the same form and server.

The administrator interftice is used by a few survey designers and data analysts. It is
used to design the form layout and create the mobile application. It sometimes allows for
data entry and viewing of the collected data. The admin interface acts as the analysis
platform and generally provides basic descriptive statistic ftinctions as well as line graphs
and bar charts.

The third component is one server which hosts the database. It includes some
mechanism to upload data from the mobile devices. Connectivity can be via internet, SMS,
or directly copying files. Once collected, the server presents the data via the administrator
client interfaces, and sometimes the mobile devices in the case of hi-directional
synchronization systems. Some systems integrate the administrator interface and the server
soflware. This is usually done when the synchronization is not done via the internet and the
data is directly uploaded from the devices.

The purpose of this review was studding the trends and possibilities of modern
telecommunication technology and the capabilities of mobile technology, their
functionality and features effectively incorporate to disaster incident occur.

36
In this review most of the authors have studied the importance of gathering
informationahout disaster situations. Richter &Hammitzsch, (2013) discuss the "location
"is very valuable inlormation for the disaster incident among other information. And also
author has emphasized the location as very essential factor when reporting any kind of
information. Then the problem arises. How to acquire a location base data in emergency
situation using technology.

Nowadays mobile technology is becoming increasingly integrated in the society. Mobile


technology has shown a considerable impact on society over the past few years. Gradually,
this technology has become a part of every person's life and is the easiest mode to deliver
information. Trenholm,(20 15) has disccused that the people do not get tired of
experimenting and exploring new apps and developers leverage this advantage to create
and innovative and challenging apps And also Different operating systems are available
br different mobile devices. Google's Android, Apples iOS, Blackberry. Symbian and

Windows are all available for development. According to study of Qian Wang & Ralph
Detcrs(2010)describe the advances in mobile technology and wire- less data
communication set-vices have made these mobile devices increasingly reasonable and more
widely available to the public. The dilemma is which mobile technology is the best one go
well with the development.

According to study of Meire (2010) among other mobile platforms. Android will be
designed to tempt consumer but the best for the development. Android has offers open and
equal alternatives for developers among other mobile technology So in this project also
target to build an application in android platform.
When study the systematic framework to acquire location base data using mobile
technology Richer S and M Hamitssch (2013) has described about a systematic way to
apply geographical information service through the mobile technology, that can be helped
emergency response teams to identify areas under threat or impact of - disaster. This system
can be implementing to obtain location data in the incident occurs. And also Assif (2012)
in his study the author has present a framework through the mobile smartphonc for disaster
management to cope with mitigation activities after a disaster. This application was able to

37
transfer data to central database through a web application. This data resided on a central
database and used for further analysis. The researcher also considered to implement the
combination of these frameworks into disaster incident occurrences. But in these studies
they didn't mention proper mechanism to transfer data to central data base without any
data connection. If the mobile has not available data connection user has to wait until
connection is properly established. This will course to lose the information. In such
situation every effort is useless. So improving this capability is very much essential for the
complete mechanism. So researcher has going to implement separate communication
module to transfer quick access data into the control room without data misplaced.

Whenwe examine above mentioned infoniation about the disaster management field it is
clear that locational data has the highest value and quicker and updated data collection
method is essential. Since then building up a disaster incident report application is a timely
need requirement in present disaster management mechanism in Sri Lanka.

38
Chapter Three
TECHNICAL INNOVATION

3.1. Existing Mobile Data Collection Systems

3.1.1. Nokia Data Gathering


Nokia Data Gathering (Nokia, 2014) is a data collection tool that runs on Nokia and
Windows phone devices. It consists of a server side and a client side. New surveys can be
created at the server side and pushed to the mobile clients for data collection. It was first
developed in Brazil for monitoing the spread of Dengue Fever by the Health Vigilance
Foundation (Ly, 2013).

3.1.2. Frontline SMS


FrontlineSMS (Frontline, 2014) is an SMS-based data collection platform. The software is
free but the user pays for the SMS sent. The software does not need the Internet to work,
sending text messages via a phone, modem or an online SMS aggregator (kiwanja.net, n.d).

3.1.3. iFormBuilder
iFormBuilder (iFormBuilder, 2014) is a data collection tool that runs on iPad and iPhone
devices. It includes skip logic to dynamically present the right questions depending on
previously provided responses. iForrnBuilder (iFormBuilder, 2014) allows for offline data
collection. It has the following features: enables Local [)atabase encryption in compliance
with PCI DSS, HIPPA, I JITECH, FISMA, 1S0900 I for data encryption requirements;

application level remote wipe and intrusion prevention; custom control of the key that is
used for field-level encryption; iForm ES encryption library compiled from the ground up
and separate from Apple's encryption library; iForm ES application library that has been
reviewed by the United States Department of Commerce; end to end encryption from
device, to sei-vei-, keyboard cache protection; Jailbreak safe. Compared to the other existing

tools studied iFurmBuildcr appears to draw strength from it elaborate security features
(Garher, 2012).

39
3.2. Mobile Implementation in Developing Countries
According to Worldbank Global IT Report (2012), in 2001 there were 20 million mobile
subscriptions in Africa and this grew to 500 million by the year 2012. Africa is now a
boiling pot oihyperconnectivity. Internet is easily accessible to more and more people and
communication between people has been made easier. Hyperconnectivity is redefining
relationships between individuals, consumers and enterprises, and citizens and state.

There are over 6 billion mobile subscriptions worldwide (Worldbank ICT4D, 2012). This
i-neans that three qual-ters oF the world's population have access to a mobile phone. In some

developing countries more people have access to a mobile phone than to a bank account,
electricity or even clean water.

According to Worldbank ICT4D (201 2) mobile adoption in the developing world surpasses
that in the developed world. Most of the developed world has a working legacy
telecommunication infrastructure while the developing world is starting mostly on a clean
slate, increasingly adopting mobile communications right from the onset. Important
innovations that make use of mobile technologies have been made in the developing world.
An example of this is mobile payments.

3.3. Mobile based Data Collection in Developing Countries


The problem in developing countries is no longer so much access to mobile devices as it is
how to maximize the use of those mobile devices (Worldbank ICT4D, 201 24 Incubation
centers for raising talent to develop applications for mobile devices have been established.
Developing countries are inci-easingly well-placed to take advantage of mobile
communications.

Traditionally, field based data collection in developing countries is done using paper-based
methods (Genesan & Jhunjhunwala, 2012). Personal Digital Assistants (PDAs) have been
used from the 1990s
mainly in the medical fields. PDAs are however affected by
challenges such as cost, power outage, and lack of robustness in handling databases.

40
In the developing world, mobile phones are increasingly being used in data collection in
areas such as reporting health statistics and advice, agricultural advisory, electronic
monitoring, customer service and natural disaster management (Genesan&Jhunjhunwala,
2012). Mobile phones are transfoniling delivery of primary and secondary healthcare in
developing countries (Woridhank 1CT4D, 2012). The use of mobile phones in data
collection has bencfltcd from the fact that phones are getting more powerful and cheaper.

3.4. Existing System for Incident Reporting


The process of disaster management involves four phases: mitigation, prel)arCdflCSS,
response, and recovery. The mitigation phase is the attempt to reduce disaster risks by
focusing on long-term measures of eliminating disasters. The preparedness phase is the
development of an action plan for an upcoming disaster. The response phase is the
mobilization of services and relief when disaster strikes and the recovery phase is the
restoration of the allected area to its previous state.

3.4.1. SAHANA FOSS


SAHANA is a free and open source disaster management system. It is a web-based
collaboration tool that addresses common coordination problems during a disaster. It is a
set of pluggable, web-based disaster management solution that provides solutions to
Problems caused by the disaster and it is designed to help during the relief phased of a
disaster. It has been already deployed in different disaster areas including the Sri Lank
disaster. In disaster management, geographic locations of those in need is important. Their
locations can either he determined using the mobile network system or through the use of
an integrated Global Positioning System (GPS) however, the current disaster management
system does not include a system to get the accurate location of the incident. Time and
Location data is important because during this kind of situations, time is of the essence and
the place. A second delay may cause soineones life. lhus. a system that determines the
number of people and provide maximum coverage of the affected area in the shortest
possible time will be beneficial.

EM
3.5. Android Platform
Android applications are primarily written using the Java programming language. The
application is then compiled into Dalvik executable (DEX) format which is a custoni byte
code. Each application executes in its own process, with its own instance of the Dalvik
virtual machine. At compile time class files and jar file are converted into DEX format, a
more efficient and compact format (Galavas&Economou, 2013).

To simplify component reuse the fi-amewoi-k allows each application to publish its
capabilities for use by other interest applications (within the limits of the security
constraints enforced by the framework). A developer can make use of the framework, APIs
and the Google developed libraries when developing

3.6. Android Application and Development Environment


Android applications are written in the Java language, compiled into byte codes which will
be converted to a .dex file (Dalvik executable file) using the dx converter. This will further
be co m-piled in to android package file (apk file), that can be installed on the android
devices. Taking in to account the multi user Linux system aspect of android OS, every
Android application is treated as single Linux user. Each of the applications on the system
is identified by a unique Linux user Id. Each process has also its own virtual machine.

Android applications are composed of one or more of the four basic application
components. The main building blocks of an android application are listedi and discusse(l as
follows

Activity

It is a core component of the android applications; Activities represent a given task that
can be clone by the application. It can also be represented as a single screen User interface
that interacts to do functions like dialing, taking photo and so on. A single android
application is composed of multiple activities. For example an android ECG app can have
an activity that shows the heart rate samples and other activity for settings or splash screen.

Services
Designed to keep running in the background, services are responsible for tasks like updates
and remote processes. Services can be implemented for time taking operations and
processes that need to be scheduled and carried out regularly. Services do not provide Uls.

Content Providers

These are used as interface to data .A content provider helps to maintain shared data
between applications. Data can be shared and modified according to permissions using the
content providers. Data encapsulation and data security is provided using content
providers. Consisteiit and secured data access is managed and maintained using content
providers and provider clients

Broadcast Receivers

These are broadcast announcements made by the system. Examples include a broadcast for
announcing that battery is low or to inform an update is ready to be downloaded. Broadcast
Receivers can be used to initiate services to do something.

One of the merits of' developing for android is the cheap and easiness of the development
environment. The Android SDK and tools are provided free of charge from the
developer's site (http://developer.aiidroid.com). In addition to this, well organized
documentations make it easy for developers to startup and (live in to the platform quickly.
While developing an(lroi(l applications, Tools from the SDK can be invoked through
command Line or the ADT. In this project, the Eclipse IDE is used for the application
development The ADT (Android Development Tools) is Eclipse plugin that is
recommended for developing android applications since it offers direct invoking of tools
during application development. (Android developers, date of retrieval 6.2.2012.)

3.7. Proposed Android Tool for Ceo-Spatial Data Collection

3.7.1. Analysis

In this study stakeholders in a data collection will be identified by relying on the


expeIience of the author in past data collection exercises. Literature was reviewed (see

43
Chapter 2) to understand manual and digital data collection methods, to establish the
existing mobile-based data collection system and their current relevance. Gaps in existing
data collection tools were also identified. Key features in existing data collection tools will
he identified for inclusion in the piototype that will be developed.

3.7.1.1. Scope
The proposed system has mechanisms for data collection, transmission, storage, data
protection and retrieval.

3.7.1.1.1. Data collect


The prototype provides a user-friendly mobile-based front-end for collected data and
submitting responses to the central server. Data collection can proceed in both offline and
online mode on a mobile device. It has been adapted a proper mechanism to working in
off] inc.

3.7.1.1.2. Transmission
Submitting of responses via the mobile-based front-end to the central database is initiated
by the respondent by clicking a button. The data is transmitted using the https protocol. On
the mobile device completed responses are transmitted to the central server by a
background process that periodically checks for completed answers in the mobile device
database. Data is stored on the mobile device storage until and good telecommunications
link is available upon which the background process submits the data over https.

3.7.1.1.3. Storage
Responses submitted via the mobile-based and web-based front-ends are stored in a
relational database in adequately normalized database tables. The data is stored securely
and in a way that it lends itself to easy retrieval and analysis. And also until make a good
telecommunication establishment all data collected from mobile app has stored their data
on local database itself.

44
3.7.1.1.4. Data Retrieval
The proposed system allows retrieval of a excel format file that is appropriate for
importing into advanced data analysis tools in web-based side. These data can be converted
into any are gis related format easily for the analysis.

3.7.1.1.5. Security
The proposed system provides for encryption of collected data on the phone, in
transmission and in the database. This is to protect any sensitive data that the tool may be
used to collect.

3.7.2. System Requirement


System requirements describe technology-independent behaviors and information needed
by the solution to. There are three types of requirements: functional, non-functional and
transition requirements. Table 3.1 shows the solutions requirements for the prototype.
Functional requirements are capabilities or things a solution must do for its users. Non-
functional requirements are quality attributes, design and implementation constraints, and
external interfaces that a product must have.

Requirement Description
I Data Collection The system should support any type of data
to collect
2 Manage the system System should provide a way to manage
system lifecycle: not started, running
,intcrmediatc ,closc
3 GPS acquiring System should provide better location based
service
4 Mobile data connection System should have data connection facility
availability checker.
5 Data storing capability The system should provide a way to
caching respOnSe until proper data
connection.
6 Data Transmission The system should have proper data

45
capability - transmission mechanism to send data to

Table 3.1: Functional Requirement

System can be in any one of the states as shown in Table 3.2.

Lifecycle stage Description


1 Not started In this stage system data co]lection can't
be done.GPS not enable data connection
not enable
2 Running In this stage data connection should be
enabling, and UPs should be enable .After
stable of the UPS data acquire, data
entering can be done.
3 Intermediate If any how data connection is not
available system processes run in
background level and whenever the
connection has stable, data send to server.
4 Close Data entering can't be done

Table 3.2: System Lifecycic

The non-functional requirements of the system are shown in Table 3.3.

Requirement Description
Performance The system should respond in less than 3
second when submit data
2 Security The system should required authentication
to identify the user
3 Availability The system should have 99% availability
24 hour a day 7 day week

46
4 Restoring System should have restore facility to
avoid the reentering same data if any
system failure.

Table 3.3: system non functional requirement

3.7.3. Use-case Diagram


This is the use-case diagram of the proposed android data collection system.

Proposed Geo-Spatil Data Collection


System

<incIudo'

Figure 3.1: Android data collection system

3.7.4. Use case Diagrams Descriptions


The use-case for Add new incident is show in Table 3.4

Use-case Name: Add New incident


Scenario: Done on mobile Application
Trigger: User needs to report incident/Collect data
Brief Description: User stat to add or enter details to system interface on the mobile.
Actor: User

47
Stakeholder: User
Precondition: GPS should enable
Post condition Data entering form enable to enter data
Flow of Event (Steps): Actor System
I. User input details to I I System save data on
interface and click send local database
to sever 1.2 System check the data
connection availability
Table 3.4: Add new incident in use case description

The use-case for Data connection availability is show in Table 3.5

Use-case Name: Data connection availability


Scenario: Done on mobile Application as background service, involving
user
Trigger: User needs to collect o repot data
Brief Description: User should enable the mobile data connection facility.
Actor: User
Stakeholder: User
Precondition:
Post condition System indicate the enable state of the connectivity
Flow of Event (Steps): Actor System
User on the data 1.1 Run the broadcast
connection on mobile reccivcr
1.2 Trigger the sync
manager
1.3 Run the sever
COITII11U iii cator
Table 3.5: Data connection availahilityin use case description

The use-case for Location service is show in Table 3.6


Use-case Name: Location acquisition

Scenario: Done on mobile Application as background service, involving


user

Trigger: User enable GPS


Brief Description: User enable the GPS on mobile ,then trigger the location listener
to find the best possible availability location service and send the
location details to mobile interface.
Actor: User
Stakeholder: Application
Precondition: GPS enable
Post condition Data entry form ready to enter data.
Flow of Event (Steps): Actor System
I. Open the mobile 1.1 System find the best
application possible location
provider
1.2 Location details send
to application
interface
1.3 Mobile app interface
ready to collect data
Table 3.6: Location service muse case description

The use-case for Sync data to server is show in Table 3.7

Use-case Name: Sync data to sever


Scenario: Done on mobile Application, involving user
Trigger: User click on submit after entering data into the interface. Location
data already appear in the interface.
Brief Description: Data send to the local database in the mobile run the data connection
availability and after properly establish connection local database
connect with the central database in the server.
Actor: User
Sta kcholdcr: Web Application users

49
Precondition: Data connectivity checker should enable with the best connection
Post condition Data stored in local database and send to central database
Flow of Event (Steps): Actor System
User send the data to 1 .1 System saved data on
server local database
1.2 Check data connection
availability, if
connection is stable
1.3 Data send to central
database.

Table 3.7: Sync data to serverinuse case description

The use-case for Display Data is show in Table 3.8

Use-case Name: Display Data


Scenario: Done on web application ,involving web app user
Trigger: Alter send data from mobile application
Brief Description: After receiving the mobile data to the web application, web user can
(10 the data exporting and data displaying.
Actor: Web Application user
Stakeholder: Web App] icalion user
Precondition: User send data to server
Post condition Data stored in central database and send respond to the mobile
application
Flow of Fvent (Steps): Actor System
User send the data to 1 .1 Web application save
server data on central database
in server
1.2 Send respond to mobile
application
1.3 Display on the map view

50
2. Web application user 2.1 System provide different
export data interface to export saved
data
Table 3.8: Display datainuse case description

3.7.5. System Designing


To be attractive to organizational leadership, the mobile and telecommunication
technology systems must require low capital costs and/or reduce labor costs. This system
will be providing a better solution for geospatial data collection mechanism in any
organization with the high security layer. At the organizational level, it is also important
that the system not become obsolete.

In this system mainly forecast on the Location based service of the mobile technology for
collect geographical important data in the field at any time. Determining the geographical
location is one of the key factors of the location based service. Geographical location can
be usually determined with coordinates latitude and longitude.

51
Figure 3.2: Proposed system Data flow diagram

52
Figure 3.3 depicts the main components of the mobile application. The main components
in the mobile application are questionnaire display, map processor, response submission,
phone access and security.

Mobile Application Web Application

Authentication

Location Acquisition

Incident submission

Phone Data
Access

Data Transmission I- - -- --I- - -1---i Incident Processing

Figure 3.3: Component diagramed of Mobile end and WEB end

3.7.5.1. Authentication
This module handles security of data access in the database. It makes use of user roles to
determine who can have access to what for system administration purposes. It also makes
use of security access of users.

3.7.5.2. Location Acquisition


This part heddle the GPS location acquire from the mobile application. This is the major
consideration of this system. There are many different technique can be use to acquire the
location from the mobile phone. But the important part is the accuracy. Accuracy is most

53
important part for the GEO spatial system. Location base service (LBS) is the main
architecture for the location acquisition from the mobile.

3.7.5.2.1. LBS Architecture

Location based services architecture is described by a 3-tiered communication model as


shown in Figure 3.4, with a database called geographic information system (GIS), used to
store location related information and location based logic. GIS is a database to store,
manipulate, analyze, manage, and present all types of geographically referenced data.

Application Layer

GIS
Middleware Layer

Postioning Layer

Figure 3.4, Architecture of LBS Adapted from lesie (2014)

3.7.5.3. Incident Submission


Submission form consists of the XML file with graphical user interface. User can fill the
required field and click the send. Then data will submit into the central database.

3.7.5.4. Phone Database Access.


Each and every data collected from user interface will saved on the local database in the
mobile phone.

3.7.5.5. Data Transmission.


Broadcast receiver activated as background service and listen to data network enable. If
the proper establishment of the data network, the data will be transfer to the centralize

54
database through the web application. After successfully transferring of data to central
database web application send the acknowledgement to mobile app. After get the
acknowledgment respective record transferred to server will update as send data in mobile

database.

3.7.5.6. Server Database Access.


Server database will he access by the web application. Mobile application (lireCtly
connected with this web application using I-ITTP (1-lyper Text Transfer Protocol) request.

3.7.5.7. Report Generation.


WEB application consists of the report generation part by providing user-friendly PHP
interface.

3.7.5.8. Incident Processing.


This process involve to connect centralize database and mobile application.

3.7.6. System Implementation


Android is Googlc's mobile operating system and is based on Linux operating system.
Android offers its Software Development Kit (SDK) for developing and designing Android
apps. For this research project standard Android development tools were used for
application development and standard practices suggested in Android development
documentation were studied. The integrated development environment (IDE) used in this
study is Eclipse (Juno) and the prograrnnling language used for software development and
customization is Java. For this JRE (Java Run Time Environment) and Java Development
Kit (JDK) was installed as well in computer system. For integrating HTML and JavaScript
eDdie within the application was used. The installations required for the application
development are as mentioned below. To understand Android programming fundamentals
and development tutorials , the website (Android Development)was rcfCrred.

3.7.6.1. Reporting System


Reporting ground reality to central system say control room is an important aspect of
disaster management. It can he used while the rescue operations are in progress and

55
majorly once the relief operations begin. For the team officer, it is crucial to report
incidents and details that are important for analysts. These details include the incident site,
exact location coordinates, images, video recordings, number of people rescued, injured
and died. The analyst can make assessment of the disaster impact both regarding life and
property. The research work enables reporting of this information through an interface
which allows user to fill in data. It is a good practice to have template report forms ready to
be used at the time of disaster.

Android application with server and data base integration for field data collection. It allows
user to fill the data that needs to be reported. These two tools have been used in the study.

Creating Server

Windows Apache MySQL and PI-IP (WAMP) version 2.0 was downloaded and installed
by following instructions from internet and set the port number for local host as shown in
Figure 3.3

11 u.... . ..... .... .q,..,..0 .,,,. ne.n

Co..flgw.Uoo
__v._ .
IddIt.fl; *bO (' Sf0.
50.0.
5o So.. Sk
500. S.o S
5..th.10M40 Sc Sth*. S'"fl
50.0 Sf0 5000..
0010.4 Y.1$Ofl 50010

Tools

a
0

Vow Projeto

Figure 3.3: WAMP Configuration and Installation

Integration with database


WAMP server already provide mysql database for centralize data repository .WEB
application build to capture data from mobile application and stored in central data
repository.

56
Form Element Description Data Type
Province Dropdown selection Text
District Dropdown Selection Text
Load according to selected
Province
DSD Dropdown Selection Text
Load according to selected
Location Data
District
Disaster Drop Down Selection. Text
Include every possible
disaster type
Location Latitude and Longitude of Number
the exact location
Family No of Affected thrnily Number
People No of affected people Number
Affected Details Death No of death Number
Injured No of Injuring Number
Missing No of missing persons Number
Fully damage No of Building Number
I)a ni age
Partially Damage No of Building Number
No of saf Location Number
Safe Location Family Number
People Number
Image Image Of the disaster Byte String
Date and Time Date and time of the Date/Time
incident

Figure 3.4: Details Contain in the mobile application

3.7.6.2.3. System Authentication

The person who supposes to provide incident must register in the web system with their

IMEI number of the mobile to prevent the unauthorized incident reporting. Any person can

58
send the incident by installing mobile app on their mobile but authorized mobile can only
be submit the incident. This mechanism prevent the unauthorized messages come from the
mobile application. Every person must responsible for their details come from their mobile
applications.

3.7.6.2.4. Location Initialization


The internal GPS of the device has been utilized to retrieve the current location of the user.
GPS gets signals through a constellation of 24 satellites. Through coding the application
realized the retrieval of the location of the device in the form of latitude and longitude.
These values were converted to a text format and displayed on the screen along with
accuracy of the coordinates. The accuracy aspect was extremely important while using the
application for Reporting purposes. To use location services in an application, an instance
of the Location Services class i.e. Location Client was used. Firstly Location Manager and
Location Listener were instantiated.

Criteria myCriteria = new CriteriaQ;


myCriteria set4ccuracy(Criteria . 4CCURACY_I-IIGI-!);
iryCriteria. setPowerRequirement (Criteria . POWELOhf);
Lnd -cd 1e:: ihe - g1: location pcide- fc ycu
String mvprovider = 1ii.get8estProvider(myCriteria, true)

lm= (Locaticnanager) getsysternService(LOCATIOf'd_SErn/ICE);


Locationprovider ip = 1m.getProvider(LocationManager.GPS_POVIDEf);
6psLocationListener gpsloc = new 5psLocationListerierQ;
lni.requestLocaticnupdates(lp.getrlameQ, 1 1000, 1, gpsloc);
'r.- qJe c:c:nLjda -ec rr 1I3, 5. gpcicc

3.7.6.2.5. Broadcast Receiver


A broadcast receiver is a component that responds to system-wide broadcast
announcements. Many broadcasts originate from the system for example, a broadcast
announcing that the screen has turned off, the battery is low, or a picture was captured.
Applications can also initiate broadcasts for example, to let other applications know that
some data has been downloaded to the device and is available for them to use. Although
broadcast receivers don't display a user interface, they may create a status bar notification
to alert the user when a broadcast event occurs. More commonly, though, a broadcast
receiver is just a "gateway" to other components and is intended to do a very minimal

59
amount of work. For instance, it might initiate a service to perform some work based on
the event.

A broadcast receiver is implemented as a subclass of BroadcastReceiver and each


broadcast is delivered as an Intent object. For more information, see the BroadcastReceiver
class.

In this study mobile application used Broadcast receiver for update the network status. It
will pop up a toast when the mobile data connect or disconnect. This service is run as
background service of the mobile phone.

3.7.6.2.6. Sync Manager


Sync manager is a java class in mobile application. It used to sync data from mobile
database to server communicator class. After broadcast receiver activate, the first class is
execute in the mobile app is sync manager.

3.7.6.2.7. Server Communicator


Web forms present a common way of communicating with the server and receiving results
from it. GET and POST methods can be utilized to send requests from an Android app,
based on the custom interface designed. By using existing java APIs in Eclipse, adeveloper
can create HTTP GET and POST requests and parse the results to display them on the
screen.

As example code given bellow.

class KttpAsyncTask extends Asynclask<Void, Void, String> {

&Cvenide
Saire a Rin rre:hcd on Thead
protected String dolnBackground(Void... params) {
u:c -geneated rnehcd nub
String result = null;
try {
HttpPost httpPost = new I-tttpPost(
"http://slrider.com/sitrep.php');
httpPost. setEntity(new UrlEncodedForinEntity(data));

ItttpClient httpClient = new DefaultFtttpC1ient;


HttpResponse httpResponse = httpclient.execute(httpPost);
InputStreair iriputStreain = httpResponse.getEntity()
getconteritQ;
BufferedReader bufferedReacier = new BufferedReader(
new InputstreamReader(inputstream));
StringBuilder respose = new StringBuilder();
String resporiseline = null;
while ((respcinseline = bufferedReader.readLineQ) null) {
respose. append(responseline);

3.7.6.3. Visualization of Data in web end


Geo-visualization in simple terms means to form a mental image of some information and
associating it with earth location. This function carmot be depicted on its own and needs
some aspect which uses it for displaying information. Hence geo-visualization has been
used for displaying current location and information send from the mobile application in
the map view. The assessment function also uses geo-visualization techniques to display
data.

Fundamental techniques used for this function are:

Report Generation
Data extraction from WEB app

61
Chapter Four

RESULT AND DISCUSSION

4.1 Features
This application processes a number of features and functions to aid in the management
and maintain of the disaster situation. The application was developed using Android,
ArcGIS desktop and ArcGIS Server. Location data collection, tracking, geospatial analysis
and data sharing for disaster management were the main concerns of the application. It is
obvious that the geospatial locations of the rescue teams are vital in mission planning and
management of the rescue teams. Three android applications developed for tracking of
rescue teams, report incidents with geo-tagged images and distribution of aids to affected
people. Those applications directly sending latitude and longitudes to the ArcGIS server
which use as inputs to the early warning system developed using ArcGIS modelbuilder.
Separate android application is developed to address epidemic diseases.

The research involved understanding requirements by personnel involved in rescue


operations and subsequently, development of application. The App has been named as
DisasterSitrep as it addresses the communication requirements of thei'escue workersfor
disaster management. The disaster management rescue operations begin as soon as the
rescue teams are mobilized. Evacuation of people and moving them to relief camps or
safety zones is given prime importance. Quick medical help is provided to those in need.
Communication and infoi'mation retrieval comes next. This is where the application
RescueApp will prove useful. The team officei' who coordinates for both rescue and relief
operations is the target user of this mobile (client) application. The information collected
by team officer is sent to the Relief Commissioner, Chief Secretary or District Collector.
These officials might further involve a third person as the analyst. That analyst is the target
end user br the server application

62
4.1.1 Login
Application is designed to validate all the inputs. Ensure the security of data by creating
different database users for each application with very limited rights to database objects.
All the data encrypts before inserting it into the database, and decrypts it when retrieving.

When a disaster occurred data must be made available to users when they need it. It is very
important in rescue and relief operation. The system always tries to maintain the
availability of data using minoring MySQL database, More over data will provide need to
know basis.

While maintain the high availability of data it is important to maintain the integrity of data.
Accordingly system will prevent unauthorized access to data. Access to data can be
restricted by using passwords and controlling access rights by login permissions. This
system includes strong password encryption methods. System uses a random salt lbr each
password. More over system limit the number of failed login attempts.

System users will be registered into the system using their IMEI numbers. Therefore even
users have the application, they cannot access to the system in order to assure integrity of
data. If the mobile phone is lost administrators can disable the IMET of the l)alicular
phone. It will prevent unauthorized access to the system.Ifmobilc reach to locations where
no GSM coverage, the Android Application will store the data by itself into internal
database and upload to the server when it received GSM coverage for first time. This will
ensure the availability of the data.

Figure 4.1 shows the Home Page of the Global Disaster Risk Analysis Application. Home
page allows user to select required page by selecting left drop down and tile graphical
interface.

63
IE 1 * ___
Risk Analysis, Pvn06n
Mitiaation Aoolication
9 IJrrs Onliri.

-1
406
Sri lanka
(l

!:
(A
., Ptportd Innidnt

Figure 4.1Home Page of the Global Disaster Risk Analysis Application

4.1.2 Rescue Operation Map


Challenge The operation commanders faced immense difficulties in the disaster situation
due to lack of knowledge about the exact locations of the rescue teams.

User Requirement - When troops in the rescue mission operation commanders and the
other relevant officers need to monitor exact troops locations which allows decision
makers to guide the troops in to exact locations and they can get a clear image of the rescue
mission, and we have to ensure the safety of the rescue team by monitoring their positions
all the time. Currently there is no any responsible organization providing such a facility to
the rescue teams.

Solution - We have developed tracking android application which can be easily installed to
any android smart phone and this application will be sent to the latitude and the longitude
of the current position to the web server in each 5 seconds.

64
AIL

Figure 4.2: Android Tracking Application

1' igitc 4.3: I raclingDa1a on web interlace

65
Administrators can easily add tracking devices to web by adding EMI numbers of the
phone. A live tracking system for the rescue teams and rescue vehicles are used Android
devices and in-house tracking devices. This application can be viewed all the tracking
devices currently by operating or devices belongs to different operational levels.

Problem - When an incident occulTed the rescue teams will be sent to the disaster areas,
these teams are controlled by centralized location and get the information through voice or
a paper based communication.

User requirements - Field Commanders, resource managers face difficulty due to lack of
information to update their maps. Manual updating let human errors and time consuming,
but still current practice is to send message through traditional message pads or described
about the illCi(lefltS through radio sets or telephones.

SolutionSituational Report Android application is designed to report the disasters. When


a disaster occurs, the user can simply run the application and application itself picks the
present location accurately by using GPS technology. Then users have to provide some
important information about the disaster, in this application drop down selectable Options
facilitated minimize the human errors. Users just need to type details about the disaster
and then take a photo ol the incident and send it to the system, within 10 to 1 5 seconds
those massages will reach the system from anywhere in the world. Then those locations of
the incidents will be stored in the MS SQL database to use for the further process of
sending warning messages and perfonn disaster analysis.
The data reported from mobile application to server system is in the form of an XML
document. The data is submitted through an HTTP request to server and the server
application parses the XML content to database with proper validation of the data types.
The conversion of XML to SQL allows the analystto query data, perfoiiu analysis and
create reports on this submitted information. Spatial analysis can be perfbrmed on this
information for example one can determine the shortest route to nearest place
requircd.Visualization of this submitted information will enable the analyst to view the

66
location on map along with the tagged image shows a satellite view with the point location.
Once
Clicked on this point, it displays the geo-tagged information recorded for this location as in
Figure 4.6.

Figure 4.4: Situational Reporting Android application

The Reporting feature allows user to upload images, location co-ordinate, video, textual
and numeric information, date and time of reporting. Figure 4.5 shows the report elements
as per First Incident Report.

67
3GbGS851Pei ?3GlIG &50 Pu
110

LOCATN UTMS
prmv

Daste

4327

0 3G W C idl I 8:51 Pu -:1- Q 3G;ilI G uI S - 8:51 PM


'SO E

AFECTED OflMt5
SUE LOCATION
NgLoc*ton FamHles

Da;e
ii.ina Ii.
-----1
iMii eii
AIIKId

D.th

Pinh

owars

Figure 4.6: Situational Reporting application

Challenge- Not sufficient aids for the people who affected by the disaster.
User requirements- Disaster management agencies require sufficient aids to distribute
among the people to stay in disaster camps due to effect of the disaster. But currently there
is no proper mechanism to distribute those aids immediately according to the actual
demands of the each camp.

Solution - Our initial response, the efforts focused on the basics human requirements such
as food, shelter, water, and sanitation. Health clinics were set up to help care for the injured
people. With the past experience, we have identified that distributing aids for the
peoplewho are very difficult and not accurate. Hence, we have developed an Android
application which can be sent.Theexact amount of the suppliers is needed and the number
of people living in the particular shelters with their gender and the age same as Situational
Report application. This will automatically pick the location and send the data to the
assigned sever using GSM within 10-15 seconds from anywhere in the country.

69
Figure 4.5: Demand App

4.1.3 Epidemic Map


Challenge - There is no proper digital system to monitor epidemic disease that spreads
rapidly among many people in a community. During the data collection process spatial
data collection and on-time data visualization has been major challenges.

User requirement - Public Health Inspectors (P1-Il) and other responsible government
agencies required a fast and accurate method to monitor and track the patients who are
suffer from the epidemic diseases like dengue. AIDS, etc... currently they do not have
such a system to help their day to day life.

Solution - This attempt has been made to introduce a GIS and Mobile Communication
based Geo-tagged epidemic data collecting by installing a specially developed Mobile
application into the Android Mobile Phones of the front line field health officers (PHIs),
enabling them to enter basic data on the patients from the field on a real time basis.
Accordingly, the data and information of the cases are geo-tagged to the user's location and
shown on Google Maps, ArcGIS Server or ArcGIS Desktop.

70
Mobile GIS System for Dengue Data Collection

r-7,_.,~ N
;
71
Coeiori of Ceng it
Pat ients Location and
Web Server
Basic Information by PHI

rcGIS - GoogleBartli

- I.
:

Figure 4.6 - Dengue application Methodology

This system will vastly reduce the time lag between collecting and reporting data and
preventive action taken by the authorities. The application is quick and easy to use for
health workers who are constantly on the move and performing multiple duties; it is simply
a click of a button, rather than pages of paper work.

Figure 4.7 Dengue application Window

71
4.1.4 Mitigation Map
Demand Report - Users can view the reports of demand send through the Demand Android
application.

4.2 Data Backup


It is essential to make integrity, availability and confidentiality of data. Someone is to acts
as the data custodian and responsible for maintaining and pmtecting the data. Furtheniore
performing regular backups of the data, periodically validating the integrity of the data and
restoring data from backup media is crucial.

Before back up data classified into different categories considering usefulness and value of
data. Network Administrator makes sure that whoever is backing up data and whoever has
access to hacked-up data. This eliminates need to store duplicate copies of unchanged data.
All the backups are to he written into DVD and keep in a secure place (offsite area) to
protect against a disaster. Frequently restore backing up to a different server to verify
backup data. This server also used as a mirror to the original server. When a disaster occurs
the mirror server can he utilized.

4.3 Application Capabilities


Following are the capabilities of this system and covered the basic of Web solution and the
Android applications exist to fulfill the requirements of the users.

Involve with the missions while stay in their own places.


Possible to get connect anywhere in the world.
Highly user friendly web solution.
Functioning in any mobile service provider's coverage area.
V. Live tracking of the movement.
Allow users to (publishers) to create their own maps and upload to the
server.
When app operated in No coverage area it will automatically back up data
and upload to the server when it received signal in first time.
Automatically picked own location and address for the application.

72
ix. System operated in user friendly environment.
X. System can install to any android device.
Software can download and install very easily to the device.
Easy access in any place.
Software can he modifying according to the requirements.
Data can he export into Are Gis capable formats.

4.4 Security Measures


GIS web services allow many operations that take user input, such as queries, edits, feature
attachments, and so forth. Esri performs periodic security audits to test its software for
vulnerabilities to SQL injection and other fonis of attacks that could come through user
input. Additionally, service administrators are given options to disable queries, download,
and uploads for individual services.

Android applications are written in the Java programming language. The Android SDK
tools compile the code along with any data and resource files into an Android package.
Once installed on a device, each Android application lives in its own security sandbox.
Android starts the I)OCCSS when any of the application's components need to be executed,
then shuts down the process when it's no longer needed or when the system must recover
memory for other applications.

In this way, the Android system implements the principle of least privilege. That is, each
application, by default, has access only to the components that it requires to do its work
and no more. This creates a very secure environment in which an application cannot access
parts of the system for which it is not given permission.Whcn it comes to secure software,
there are Some tenets to accomplish. These basic tenets are:

protection from disclosure (confidentiality),


protection 11-om alteration (integrity),
iii protection from destruction (availability),
iv. Who is making the request (authentication)
V. What rights does the rcqucstor have (authorization).
4.5 Application Testing
Incident Report system has been tested in India, China, Japan, and Mongolia in order to
check the accuracy in the international missions.

Figure 4.8 Global Testing

74
TcTki
Teid Lo.w1ak

Mi lip tlt liiaaed


MI iciik
w6w u
No

ZG Uplu3TI NOMA
IN Use

tJpM

.-H Up to

Upmn 22 i* - j7f
No SkMA3 Upb
LV"Umptifift

Nil 10 fiecoodi.
FUL.tI
L)c F4Isvi Lti, Aic*uii.y and SMUCSIMCS -3O kciinl
an lSIlt at

NIdd tc

Urbam Sm -2'k -

Oosul CIcf Up 1, 3g itcoads

Ht11idk Upii&

HIy Tm.igi kIb-.14k IU- ICCfflI

Table 4.1: Testing result of the situation report app

Wi h.on a 10 S .n,m.h Nd

: : 11
S.4tAIr !, nd. Na

41*1 iun 440 cci 5 lffld 10d

Table 4.2: Time variation with network coverage

75
The testing results as displayed in above are discussed here. After perfirming the network

testing, it was found that GPS exhibited same accuracy in presence and absence of
Network but the time consumed to display GPS results varied. Using Wi-Fl. reduced GPS
loading time since it itself gave an accuracy of up to 22 meters. Maps loading and
information display was best with Wi-Fi and 3G network. The 2G network comparatively
took more time to display maps and satellite imagery. As proven theoretically, cloud cover
and humidity had no influence on GPS signals but dense forest greatly affected it. It was
almost at the verge of getting no signal for a long time. Hilly terrain and urban area
affected GPS signals in some areas as experienced while walking or travelling besides a
trail of high mountains, standing near the entrance of a building and between clusters of
bui I di iigs.

Network connectivity was affected in hilly areas and alternative available network had to
be manually chosen. In absence of network, GPS gave the same accuracy but it took longer
time tp display results as co]1]pared to the time taken in the presence of network. Maps
could he loaded and displayed in absence of network as well. This was because the maps
were used earlier and thereby stored in cache memory. They showed uponly for the
location they were earlier used.

The app consumed minimal memory and battery. While the App was running, the battery
consumed was about 2% of the total hours remaining for use. The total memory used by
the app was around 14 MB. Internal storage memory consumed by Disaster Sitrepwas 9.84
MB and external storage of 4 MB.

For usability testing, the application was distributed to users in separate locations and
asked for screenshots of the application. A small introduction about each feature helped
the users understand and use the application with ease. The application gave location
details for different user locations. It was checked on different Android versions (4.0.4,
4.1.2, 4.3) as well. It gave some package parsing issues when checked with the latest
Android version 4.4 but after updating the Android 4.4 operating system to the latest
version, it worked well.

76
4.6 GIS for Emergency Management
Most of the data requirements br emergency management are of a spatial nature and canhe
located on a map. Proposed architecture focus on how data is acquired, displayed, and
utilized in all aspects of public safety programs. This section will illustratehow GIS can
fulfill data requirement needs for planning and emergency operations andhow GIS can
become the backbone ol emergency management
All phases of emergency management depend on data from a variety of sources.
Theappropriate data has to be gathered, organized, and displayedlogically to determine
thesize and scope of emergency management programs. During an actual emergency it
iscritical to have the right data. at the right time, displayed logically, to respond and
takeappropriate action. Emergencies can impact all or a number of government
departments. Proposed system can be implemented to gather such kind of data very
accurately and efficiency.

Emergency personnel often need detailed information concerning pipelines, building


layout, electrical distribution, sewer systems, and so forth. By utilizing a GIS, all
departments can share information through databases on computer-generated maps in
onclocation. Without this capability, emergency workers must gain access to a number
ofdepartment managers, their unique maps, and their unique data. Most emergencies do
notallow time to gather these resources. This results in emergency responders having to
guess, estimate, or make decisions without adequate information. This costs time, money,
and in some cases lives. GIS provides a mechanism to centralize and visuallydisplay
critical in formation during an emergency.

4.6.1 PJanning
Emergency management programs begin with locating and identifying potentialernergeney
problems. Using a GIS, officials can pinpoint hazards and begin to evaluatethe
consequences of potential emergencies or disasters. When hazaids (earthquake faults, lire
hazard areas, flood zones, shoreline exposure, etc.) are viewed with other map data (streets,
pipelines, buildings, residential areas, power lines, storage facilities, etc.),

77
emergencymanagement officials can begin to formulate mitigation, preparedness,
response, and possible recovery needs. Lives, property, and environmental values at high-
risk from potential emergency or disaster become apparent. Public safety personnel
canfocus on where mitigation efforts will be necessary, where preparedness efforts must

hefocused, where response efforts must be strengthened, and the type of recovery
effortsthat may be necessary. Bethre an effective emergency management program can
beirnplcmented, thorough analysis and planning must be done. GIS facilitates this
proccssby allowing planners to view the appropriate combinations of spatial data
th ro ughcomputcr-generated maps -

4.6.2 Mitigation
As potential emergency situations are identified, mitigation needs can be cleteniiined
andprioritizcd. In the case of an earthquake, what developments are within the
prinlaryimpact zone of earthquake faults? Based on the expected magnitude of an
earthquake, characteristics of soils, and other geologic data, what damage may occur?
What facilitiesrequire reinforced construction or relocation? What Facilities are in high
hazard areas(key bridges, primary roads, freeway overpasses, hospitals, hazardous material
storagefacilities, etc.)? Mitigation may include implementing legislation that limits
building inearthquuke or hood zones. Other mitigation may target fire-safe roofing
materials inwild land fire hazard areas. Values at risk can be displayed quickly and
efficientlythrough a GIS. utilizing existing databases linked to geographic features in GIS
rnakcsthis possible. Where are the fire hazard zones? What combination of features
(forexample, topography, vegetation, and weather) constitutes a fire hazard? A GIS can
identifyspecific slope categories in combination with certain species of hlammahle
vegetationnear homes that could be threatened by wildfire. A GIS can identify certain soil
types inand adjacent to earthquake impact zones where bridges or overpasses are at risk. A
GlScan identify the likely path of a flood based on topographic features or the spread of
acoastal oil spill based on currents and wind. More importantly, human life and
othervalues (property, habitat, wildlife, etc.) at risk from these emergencies can be
quicklyidentified and targeted ftr protective action.

78
4.6.3 Prepareclness
Preparedness includes those activities that prepare for actual emergencies. GIS canprovidc
answers to questions such as Where should fire stations be located if a fiverninuteresponse
time is expected? How many paramedic units are required and whereshould they be
located? What evacuation routes should be selected if a toxic cloud orplurne is accidentally
released from a plant or storage facility based on different windpatterns? How will people
be notified? Will the road networks handle the traffic? Whatfacilities will provide
evacuation shelters? What quantity of supplies, bed space, and so forth, will be required at
each shelter based on the number of expected evacuees?

4.6.4 Response
GIS can provide one of the primary components for computer-aided dispatch (CAD)
systems. Emergency response units based at fixed locations can be selected and routedfor
emergency response. The closest (quickest) response units can be selected, routed, and
dispatched to an emergency once the location is known. Depending on theemergcncy, a
GIS can provide detailed information before the first units arrive. Forexample, during a
commercial building fire, it is possible to identify the closest hydrants, electrical panels,
hazardous materials, and floor plan of the building while en route to theemergency. For
hazardous spills or chemical cloud release, the direction and speed ofiuiovcmcnt can be
modeled to determine evacuation zones and containment needs.

4.6.5 Recovery
Recovery efforts begin when the emergency is over (immediate threat to life, property and
the environment). Recovery efforts are oflen in two phases, short term and long term.

4.7 Discussion
To overcome communication gap between emergency teams ifltro(lUce this system to
facilitate the both reporting and analysis part.

Indicate teams live movements on Google map using coordinates which sending from
tracking devices. Once people on the ground we (10 not have accurate locations of them,
thercthre have introduced live tracking system for the team, this GPS embedded devices

79
send location using latitude and longitude in every two seconds, using those receiving data
system display the location on Google map.

Handling large number of incoming data to the server. I used following methods to

overcome the pi-ocessing time of the system

Used the most efficient (smallest) data types possible

Declared columns to be NOT NULL if possible

The primary index of a table created as short as possible

Created only the indexes that I really need.

Analysis and planning are critical activities that must be carefully completed before
beginning GIS implementation. This causes a conflict, as creating detailed requirements
and committing to the design of a system in a certain way. The main feature of this
approach is that user input is taken into account throughout the development process of the
system.

System design and implementation are occurring; the organizational issues that facilitate
the design and affect the implementation and adoption of the GIS must also be addressed.
he key to success is coordinating all of the goals, activities, and impacts

Quality of service issues also need to be considered when designing such web application.
A user-centric approach the design of a system is paiticularly important when it
developing. Systems require that user interfaces facilitate universal accessibility. This kind
of accessibility can only be achieved through knowing the potential users of a system and
developing the technical requirements of the system to cater to the needs of these users.

Developing such a web application required to study relevant type of web application and
software. I obtained some details of the commercial soflware and services from web sites
or quotes. Following Table 4.3show some findings.

80
Category Closed Source Open Source

Database - Store spatial data, Raster and ArcGIS MySQL,PostGIS


Server,CuheSTOR,
Vector data, queries by attribute
Oracle Spatial
Geo Server - Geographic data servers, AreGIS Server, FcaturcServer,
CubeSERV,
prov]de Geographical data, vector and , MapGuide,
ERMapper s Image
raster, to mapping clients through requests Web Server OpenSource
that specify the layer, data foi-mat. Server,
Coordinate system, proj eel ion MapServer
Web Mapping - Display maps that ka-Map, MapGuide GoogleMaps,
Arc Web
combine online data from map OpenSource Viewer
Services,
Or geographic data servers with local data (AJAX), msCross, MapQuest,
MapTech,Mapufa
without Open Layers,
cture,
Requiring installation of software 011 the p.mapper,WorldKit MultiMap, Platial,
Virtualharth Yaho
client.
o!
Maps
Map Builder - Require installation on the Oracle Map Bender,
server and are thus difficult to implement MapVicwer, MapBuilder,
in a shared hosting environment pointMapper, MapGuide
TNTMapBuilder OpenSource
V jew er
(DWF), Mapnik
Web Geographic Processing Service ArcGIS Server, CartoWeb4,
(WPS) - Perform geographic analysis, Asp Map, MapGuide
such as creation GeoMeclias OpenSource
And editing of features, buffer and Server,
overlay

Table 4.3 - Findings table

81
Chapter Five
CONCLUSION AND RECOMMENDATION
5.1. Introduction

Initially mobile phones were developed only for voice communication but now days the
scenario has changed, voice communication is just one aspect of a mobile phone. There are
other aspects which are major focus of interest. Two such major tactorsare web browser
and G1S services. Both of these functionalitics are already implemented but are only in the
hands of manufacturers not in the hands of users because of proprietary issues, the system
does not allow the user to access the mobile hardware directly. But now, after the release
of android based open source mobile phone a user can access the hardware directly and
design customized native al)plications to develop Web and GPS enabled services and can
program the other hardwarecomponents like camera etc.

The use of mobile communication devices, such as smartphoncs and cellular phones, for
field data collection is increasing due to the emergence of embedded Global Positioning
Systems (GPS) and wireless Internet access. Accurate, timely and convenient field data
collection is required for disaster management and a quick response during emergencies. In
this project. the utilization of wireless Internet access and smartphones in field data col-
lection is handy and timely manner. Moreover, the construction of Web-GIS provides a
pre-cletined user-friendly Web-based survey form and coordinate inlonnation from mobile
devices, which dramatically improved the finding of locations and entering of data during
the field work. The Web-GIS also collects, integrates and processes all field data entered,
which eliminates data handling tasks after the field survey. Due to the real-time
information approach, the results can be viewed, queried and analyzed instantly, based on
up-to-date intorma-tion. This is ideal for use in disaster and emergency response systems
and in meteorological data collection. The system itself is reusable and updatable for
various field data collection purposes.

The LBS application can help user to find hospitals, school, gas filling station or any other
facilityof interest indicated by user within certain range. Just like a GPS device its location

82
will also be updated as soon as user changes his/her position. These all capabilities arc
used for the disaster situation reporting mobile application.

The primary objective of the research was to build an Android application surviving by
information and communication requirements envisaged by discussions with the disaster
management teams. The functionality proposed for the mobile application addresses the
elicited requirements. Each function has a feature in the application dedicated to it. Also
utmost cai-e has been given to make the application as user-friendly as possible. Textual
detail has been kept minimal on the screen but still each feature has been explained well.
The application involves various data sources to make predictions available.

And also web based online system has four main Web GIS functions

Distribution of planning information

Platform for operational planning (through interactive participation)

Platform for sharing data

A plattbnn for managing GIS data

Therefore this system has developed for WebGIS project to fulfill the requirements highly
expecting by the geospatial data collectors. Furthermore it is evident that disaster needs
maps for different purposes within its Operational command and each requirement is to
cater for a specific purpose. The digital base in GIS environment facilitates the creation of
different types of maps to meet specific user needs without clustering with unwanted
details. This web application facilitates the viewer to mark spatial information on need to
know basis either at command headquarters or in the field area.

In order to meet the approach stated GIS web based application has been developed using
php, html, dhtml, xhtml, Javascripts, ASP.NET, Web server installation and configuration,
Database configuration and designing using Mysql, Security.

O.)
Web based GIS application programming interfaces allow developers to utilize the power
of displaying geographical information without having to create complex mapping
soflware themselves. Developers can use these web services to specify how they want
maps to be displayed. All of the specialist knowledge of having to draw the maps is

handled completely by the web service.

The Internet uses a client server approach for distributing information. lnft)rmation is
stored and processed on servers and then sent to a client when it is requested. This process
is usually camed out to send and the data from the develop system. APIs provide access to
GIS functionality that has been developed, when a client sends a request to an API, the
server passes this request to the program for processing. When the program responds,
l-ITML-forrnatted results are sent back to the server, and subsequently to the client's

browser.

The most important technical factor to be determined is the architecture of system. The
system architecture designed such a way to deal with major components of a system and
interact with each other. In order to develop and display the full architecture of a system
each of these components has been briefly descnbed in more detail in Technical
Innovation chapter.

5.2. Recommendation

Given that the requirement for enhanced location inlormation does not have a high priority
within the emergency organisations consulted, and that the costs of implementing a higher
accuracy system would be high there appears to be no clear cost-benefit justification for
significantly modifying the existing regulatory arrangements. It is therefore recommended
that this situation should be reviewed at regular intervals, ie annually, in order to assess
whether the user requirement is increasing in priority and also to assess whether the
developing technologies are becoming sufficiently pervasive and affordable.

WebGlS database and associated web applications will have the power to extend well
beyond environmental investigations. Thus this system incorporating all relative data into

84
the database to include not only ground analysis but also decision making process.
Therefore, the technology architecture is available for this project to become a reality and
grow into an entirely new fonn of WebGIS system.

ArcGis is well known software dominating in Gis field of duties. It required knowledge to
handle the software and good hi-end computers to process in smoothly.

For this development I have develop my own Map engine, because closed source required
more money and required to update according to software owners requirement, Open
source software can be neutralized but required more knowledge and hard to configure.
This web application is very simple but comprehensive system.
References

Anon, 2011 Native and HTML5 : What s the difference? Comparing Native Apps With
HJML5; What is the rig/il approach for your organisation, pp. 1-11

Asif, M.2012, A Web-based Disaster Management-Mitigation Framework Using


Information and Communication Technologies and Open Source Software. JU Journal
of Information Technology, 2012. Vol. I

Beaubrun, R., Moulin, B. & Jabeur, N., 2007. An Architecture for Delivering Location-
Based Services. , 7(7), PP 160-166.

Braun, R. ci al., 2013. Community health workers and mobile technology: a systematic
review of the literature. PLoS ONE, 8(6), p.e65772. Available at:
http://www.ncbi.nlm.nih.gov!prne/articles/PMC3680423/pdf/pone.0065772.pdf

Beaubrun, R., Moulin, B. & Jabeur, N., 2007. An Architecture for Delivering Location-
Based Services. ,7(7), pp.160-166.

Braun, R., 2013. Community health workers and mobile technology: a systematic ieview
of the literature. PLoS ONE, 8(6), p.e65772. Available at:
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3680423/pdf/pone.0065772.pdf.

Couper, M.P., 2005. Technology Trends in Survey Data Collection. Social Science
Computer /?evievi', 23(4), pp.486-501

Doner, F. and T. Yomralioglu,2008, Examination and comparison of mobile GIS


technology for real time geo-data acquisition in the field. Survey Review, 2008.
40(309): pp. 22 1-234.

D'Roza, T.. and Bilchev, G,2003. An overview of location-based services. BT Technology


Journal 21, 1 (2003), 2027

Eleiche, M.A. and B. Markus 2011, Network Analysis Methods for Mobile GIS. 2011,
University of West 1-I ungary

Farnham. S., E. Pedersen, and R. Kirkpatrick,2006. Observation of Katrina/Rita Groove


deployment: Addressing social and communication challenges of ephemeral groups.
in Proceedings of the 3rd International I SCR AM Conference. 2006

Fajardo, J.T.B. & Oppus, CM., 2009. Implementation of an Android-Based Disaster


Management System. , pp.1S.

86
Fajardo, J.T.B. and C.M. Oppus,2010, A mobile disaster management system using the
androicitechnologyWSEAS Transactions on Communications, 2010. 9(6): pp. 343-
353.

Fischer, Henry W., III. 1998. The Role ol' the New Informatioii Technologies in
Emergency Mitigation. Planning. Response and Recovery" Disaster Prevention and
Management 7 (1): 28-3 7.

Gomez, D. 2013, A Review on Mobile Applications for Citizen Emergency Management,


in Highlights on

itu, 2015. ICT Facts & Figures. The World in 2015. ,p.6.

International Telecommunication Union. The World in 2014: 1CT Facts and Figures, 2014
Accessed September 22. 2014. - pages 10

Jiang, B. and X. Yao,2006, Location-based services and GIS in perspective. Computers,


Environment and Urban Systems, 30(6): pp. 7 12-725.

Jung, C., 2011. 1 lumanitariaN Operations Mobile Acquisition of Data.

Karnatak, l-1.C., 2012, Spatial mashup technology and real time data integration in geo-web
application using open source GISa case study for disaster management. Geocarto
International,. 27(6): pp. 499-514.

Kevany, M.J.2005, Geo-int'ormation for disaster management: lessons from 9/11, in Geo-
in formation for disaster management, Springer. pp. 443-464

Kohli, S.,20 11 , Sahana Eden Essential Guide, Google Summer of Code Documentation
Summit, Mountain View, USA, 1 8-20 October 2011, publisher: Lulu Enterprises.
2011, Inc.

Kushwaha, A. and Kushwaha. V., 2011. Location Based Services using Android mobile
Operating System.pdf. international Journal o/Advances in Engineering &
Technology, 1(1), pp. 1 4-20.

Kushwaha, A. and Kushwaha, V., 2011. Location Based Services using Android mobile
Operating System.pdf. international Journal of Advances in Engineering &
Technology, 1(1), pp. 1 4-20.

Luca Chittaro 2006. Visualizing information on mobile devices. Computer, 39(3):40-45,


March 2006- - pages 11

87
Ma, L., Gu, L and Wang, J., 2014, Research and Development of Mobile Application for
Android Platform. international .Jow'nal oJMultimedia and Ubiquitous Engineering,
9(4), pp.187l98. Available at:
littp://www,sei-sc.org/iouriials/IJMUE/vo]9 iio4_2014/20.pdf.

Meier, R., 2010. 4ndroid Application Developineiit, Available at:


http://hooks.google.com/hooks? id=ewMdnKNY fOsC&pgis= I.

Michael Trucano, 2014. Using mobile phones in data collection.

Monzavi, A. and Darwish. R., 2014. Comparison of HTML5 and Native Client
Development on Mobile Platforms. , (May).

Palen, L., Vieweg, S., Sutton, J., Liu, S., Hughes, A. (2007). Crisis Informatics: Studying
Crisis in a Networked World. Proceedings of the Third International Conference on
E-Socia! Science, Ann Arbor, Ml, Oct 7-9, 2007.

Palmer, N.Raven,201 2: Using Smartphones For Collaborative Disaster Data Collection. in


Under Submission To The Intl. Workshop on Information Systems for Crisis
Response and Management (ISCRAM 2012). 2012.

Pro ject,T.A.O.S.AndroidDevelopmentAvailablefi'orn:
http://developer.androicl.com/training/index.html .[Accessed 14/11/201 5]

Practical Applications of Agents and Multi-Agent Systems. 2013, Springer. pp. 190-201.

Qian Wang and Ralph Deters 2010. Mobile devices, scalahil- ity amp; digital ecologies. In
2010 4th IEEE Interna- tional Conference on Digital Ecosystems and Technologies
(DES]), pages 124-129, April 2010. -* pages 10, 11

Richter, S. and M. Flammitzsch,201 3. Development otan Android App for notilication and
reporting of natural disaster such as earthquakes and tsunamis. in EGU General
Assembly Conference Abstracts.

Singhal, M. and A. Shukla 2013, Implementation of Location based Services in Android


using GPS and Web Services. IJCSI International Journal of Computer Science
Issues,. 9(1).

Shao, Z. ,2011.A Rapid and Reliable Disaster Emergency Mobile Communication System
via Aerial Ad Hoe BS Networks. in Wireless Communications, Networking and
Mobile Computing (WiCOM), 2011 7th International Conference on. 2011. IEEE.

88
Sung, S.J., 2011. How can we use mobile apps for disaster communications in Taiwan:
Problems and possible practice. 8/h International Telecommunications Society (iTS)
Asia-Pacific Regional Conference. Available at:
litti)://www.ecoiistor.cu/handlc/I 0419/52323.

Trenholm, R.R., 2015, Improving Maintenance EffIciency in Kelowna Parks using a


Mobile Application. , (January).

The, ON., Of, P. & Networked, T.H.E., 2015. Mobility Report. Eicscon MobililyReport.

Trenholm, R.R., 2015. Improving Maintenance Efficiency in Kelowna Parks using a


Mobile Application. , (January).

Tsai, M.-K. and N.-J. Yau.2013, Improving information access for emergency response in
disasters. Natural Hazards: pp. 1-12.

Tsou, M.-H. and C.-H. Sun,2006, Mobile GlScrvices applied to disaster management.
Dynamic and Mobile GIS: Investigating Changes in Space and Time,

Volker Paclke, Christian Reimann, and Waldemar Rosen- bach 2003 . A visualization
design repository for mobile de- vices. In Proceedings of the 2nd International
Conference on Computer Graphics, Virtual Reality, Visualisation and Interaction in
Africa. AFRIGRAPH '03. pages 57-62, New York, NY, USA, 2003. ACM. -* pages
11

Virrantaus, K., Markkula, J., Garmash, A., Tcrziyan, V., Veijalainen, J., Katanosov, A., and
Tirri, H, 2001. Developing gissupported location-based services. InWeb information
Systems Engineering (2001), IEEE, pp.6675.

Yodmani, S. Hollister, D. (2001). Disasters and Communication Technology: Perspectives


from Asia. Paper Presented at the Second Tampere Conrcnce on Disaster
Communications, 28-30 May 2001.

89
Appendix

Disaster Sitrep : Java Code

package lk.defence.dir;
import j ava.io. ByteAlTayOutputStrcarn
import java.io.FiIc;
import java.io.FilcNotFoundExccption;
import java.io. lOException;
import java.io.InputStream;
import java. security. Publi eKey;
import j ava.text. SimpleDateFonnat;
import java.util.ArrayList;
import j ava.util . Calendar;
import java.util.List;
import lk.defencc.dir.db.DbHe]per;
import 1k .defence.dir.poj o. DenguData;
import lk.defence.dir.pojo. Dsd;
import lk.defnce.dir.pojo.Gnd;
import lk.defence.dir.pojo.Rowltern;
import 1k .defence.dir.uti I Custom ListVicwAdaptcr;
import Ik.defence.dir.util .NetworkChcckUtilDisaster;
import android.app.Activity;
import android.app.AlcrtDialog;
import android.app.ProgressDia]og;
import android.contenl.ContentValucs;
import android.content.Context;
import android .content.Dialoglnterface;
import android.content.lntent;
import android.content.SharedPi-efrences;
import android.databasc.Cursor;
import android.database. sqlitc. SQLitcDatabasc;
import android graphics. Bitmap;
import android graphics. BitmapFactory;
import android. location .Criteria;
import android. location. Location;
import android.Iocation . LocationListener;
import android.location. LocationManager;
import android. location. LocationProvider;
import android.nct.Uri;
import android.os.Bundlc;
import android.os. Environment;
import android. preference. PrcferenccM anager;
import android.provider. MediaStore;
import android.provider. MediaStorc. Images;
import androi d.telcphony.TelephonyManager;
import android .tcxt. Editable;
import android.texLTextWatcher;
import android.ut1l.Base64;
import android .view. Layoutlntlater;
import android.view.Mcnu;
import android.view.View;
import android.vicw.VicwOnClickListener;
import android .view.VicwGroup;
import android.view.Window;
import android.widget.AdapterView;
import androidwidgct.AdapterVicw.OnitemClick Listener;
import android.widget.AdapterView.OnitcmSclectcd Listener;
import android.widget.ArrayAdapter;
import android.widget. BaseAdaptcr;
import android.widget.Button;
import android.widgct.DatcPicker;
import android.widgct. EditTcxt;
import aiidroid.widgct. ImageView;
import androi d.widgct. ListVicw;
import android.widget.Spinner;
import android .widget.lextView;
import an(li-oidwiclgetToast;

import com.googlc.android.gms.rnaps.model.LatLng;

public class DisasterDataForm extends Activity implements


OnitcmScicctcdListcncr, OnCli ck Listener, LocationLi stcner {
private EditText affectpeopl cedittect;
private EditText affectfamilyedittext;
private EditText affectdeathedittext;

11
private EditText injuredEditetext;
private EditText misingEdittext;
private EditText fullyEittext;
private EditText partialyEdittext;
private EditText safelocEdittext;
private EditText farnilyNosEdittext;
private EditText safepeopleEdittext;
private Button dateButton;
private Button saveButton;
private Button ahoutusButton;
private Spinner gendcrSpinner;
private Spinner sickcatogorySpinner;
private Spinner disaster;
private Spinner dsdspin;
private List<String> dsd;
private List<Dsd> dsd!ist;
private ListView gndListVicw;
private EditText gndEditText;
private EditText housenoEditText;
private TextView locationTextView;
private TextView id;
private TextView name;
1/ photo
private Button tabephotoButton;
private Un irngUri;
private ImageVi ew photolrnagcVicw;
private Bitmap photo:
private I nputStrearn inputStream;
private SharedPreferences sp;
private String path;
private String s;
private static final mt CAM_REQUEST = 1313;
private String b="NULL";

private LocationManager locationManager;


private LocationProvider locationProvicler;
private LatLng bc;
private ProgrcssDiabog progressDiabog;

itt
/1 Gender Spitier
/1 private List<String> GenderDescripter;
private String selected Di stri ctdiscripter;
private String selectedDS DDescripter;
private i ft selectedGenclerPosition;
1/ Sick category spiller
private Li st<String> sickeatogaryDescripter;
private String selectcdprovinceDescripter;
private String selectedDisasterDescripter;
/1 private mt sd eetedsi ckeatogaryPosition;
private An-ayLi st<Gnd> dengudatagnd
private Li st<S tring> strgndname;
/1 private ArrayList<DenguData> dengudatagndlist;
private List<Rowltern> rowlterns;
private Li st<Rowltern> rowlternstwo;
private I ist<RowItern> rowlternsdisast;

String[] strings = { "North Central Province", "Nothern Province",


"Southern Province", "Eastern Province", "Central Province",
"North Western Province", "Western Provinc&',
"Sabaragarnuwa Province", "Uva Provi nec" };
String[ I subs = "North Central Province", "Nothern Province",
"Southern Province", "Eastern Province", "Central Province",
"North Western Province", "Western Provi nec",
"Sabaragamuwa Province", "Uva Province"

mt arr images[] { R.drawable.ncp, R.drawable.nothern, R.drawahle.soutlip,


R.drawable.ep, R.drawable.cp, R.drawable.nwp,
Rdrawable.wp, R.drawahle.sp, R.drawable.up
String[] stringsl)isaster = { "Wind",
"Flood","Earthquakcs","Tsunanli","Droughts","Tornados","Wildfires"
String[] subsdist = "Wind",
"Flood","Earthquakes","Tsunanli","Droughts","Tornados","\Vi ldfires" };
mt arr imagcsclisast[] = { R.dravable.wind, R.drawable.fllood,Rdrawahle.eq,
R.drawahle,tsunami,R.clrawable.drought, R.drawab]c.tonado,R.drawable.fire};

String] strDist;
Di sasterDataForm activity = this;
@Overridc
public void onCreate( Bundle savedlnstanceState)
requestWi ndowFcature( Window. F EAT1J RE_NO_TITLE);
super.onCrcatc(saved InstanceState);
overridePendingTransition(R.anim.fadein, R.anim.fadcout);
setContentView( R.layout.activity disaster_data_form);

/1 loadDistrict();

rowitems = new ArrayList< Rowltcm>O;


for (mt i = 0: i < strings.lcngth; i++)
Rowitem item = new Rowltem(arr irnages[i], strings[i], subs[i])
rowltems.add(item);

rowltemsdisast = new A rrayList<RowItem>;


for (mt i I = 0; ii < stringsDisaster.lengtli; ii ++) {
Rowltem item = new Rowltem(arr irnagcsdisast[i 1],
stringsDisaster[i 1], suhsdist[i 1 ]);
row ltemsdisast.add(itcin);

strgndname = new ArrayLi st<String>Q;


Systcm.out.println("Date :" + giveDatcO):
name = (TcxtVicw) find VicwByld(R.id.textView2);
id = (TextView) find VicwByld(R.id.textVicwl);

injuredEditetext=(EdilTcxt)findViewByld(R.id.injuredcdittcxt);
misingEdittext=(EditText)findVicwByld(R.id.missingedittext);
fullyEittcxt=(EditText)findViewByld(R.id.fullycditext);
partialyEdittext=(EditText)findViewByld(R.id.partiallyedittcxt);
safclocEdittext=(EditText)findViewByld(R .id.safelocedittext);
farni!yNosEdittext=( EditTcxt)find ViewByld( R.id.familynosedittext);
safepeopleEdittext=(E(IilText)iindViewByld(R .id.saftpeop1ecdittext);

affcctpeoplecdittect = (EditText) find ViewByld(R.id.name edittext);

V
affectfamilyedittext = (EditText) find VicwByld( R.i(1.niceditText);
affectdeathedittext = (EditText) find ViewByld(R.id.age edittext);
housenoEditTcxt = (EditText) find ViewByld(R.id.houseno_edittext);
SI) = PretrenceManagcr.getDefaultSharedPreferences(this);
// Photo
tabephotoButton = (Button) find ViewByld(R.id.photo);
tabephotoButton .setOnClickListener(thi s);
photolrnageVicw = (IrnageView) find ViewByld(R.id.imageViewl);
II //////////////////end photo
7/ search gnd
gndListView = (ListView) findViewByld(R.id.gndlistVicw);
gndEditText = (EditText) findViewByld(R.id.gn(leditText);
dcngudatagnd = new ArrayList<Gnd>Q;
gndEditText.addTextChangedListener(new TextWatcher()

public void onTcxtChanged(CharSequcnce s, mt start, mt before,


mt count)
7/ TODO Auto-generated 111 ethod stub
search (s .toS tn ngQ);

public void heRreTextChanged(CharSequcncc s, mt start, mt count,


mt after)
1/ TODO ALito-generated method stub

public void afterTextChangcd( Editable s)


7/ TODO Auto-generated method stub

saveButton = (Button) find VicwByld(R. Id save button):


savcButton.setOnClick Listener(thi s);
progressDialog = new ProgressDialog(this);
progressDialog
.sctMessage("Searching for the current location, please wait
progrcssDialog.showO;

vi
locationTcxtVicw = (TextView) findVicwByld(R.id.!ocation_textView);
dateButlon - (Button) findVicwByld(R.id.(Iate_hutton);
dateButton .setOnCl ickListener(tliis);
II Sick categary spiner
sickcatogorySpinner = (Spinner) find ViewByld(R.id.sickcatogory_spinncr);
sickcatogorySpinner.setOnitemSelected Listener(this);

Il//Disaster spiner
disaster = (Spinner) find ViewByld(R.id.disastcrspin);
disastcr.setOniternSel ected Listener(this);
II /
dsd = new ArrayList<String>O;
dsdlist = new ArrayList<Dsd>O;
dsdspin = (Spinner) find VicwByld(R.id.dsdspiner);
dsdspin.setOn LtcmSelectedListener(this);
disastcr.sctAdapter(new CustomListViewAdaptcr(DisasterDataForm.this,
R.layout.row, rowltemsdisast));

genderSpinner = (Spinner) find ViewByld(R.id,gender_spinner);


genderSpi nner.setOn lternSelectedListener(this);
genderSpinner. setAdapter(new CustornListViewAdapter(
DisasterDataFonn this, Ri ayout.row, rowitems));
1/
initi lizeLocationListeningO;
if(Ioc != nu]I)
locatioiiTextView.set!ext(Double.toString(loc.latitucic) H- "
H- Double.toString(loc.longitu(le));

private void initilizeLocationListening() {


location Manager = (LocationManager) getSysternService( LOCATI ON_S ER VICE);
Citeria criteria = new CriteriaQ;
criteri a.setPowerRec1uirernent(Criteria.POWER LOW);
critcria.setAccuracy(Criteria.ACCU RACY_COARSE);
locationProvider = locationManager
.getProvidcr(LocationManager.GPS_PROVIDER);
locationManager.requestLocationUpdates(IocationProvider.getNaineO,
5000, 100, this);

vii
private void loadDistrict() {
Systeimout.println("selected provice :' + selectedDistrictdiscriptcr);

if (selectedDi strictdiscripter.equals( "Nothern Province")) {


strDist =new String[] { "Jaffna', Kilinochchi'T, "Vavuniya",
"Niullaittivu" "lvlannar"
String[j substrDist = { "Jaffna", "Kilinochchi", "Vavuniya",
"J\'lullaittivu", "l'vlannar"
mt arr irnagestwo[] = { R.drawahle.hul!ei_trianglc_bluc,
R.drawable.bul let triangi c_blue,
R.drawablc.bullct triangle_blue,
R.drawablc.bullet triangle blue,
R.drawablc.bullcttriangl e blue };

rowltcmstwo = new ArrayList<RowItern>;


for (jilt ii = 0; ii < strDist.lcngth; ii ++)
Rowitem item = new Rowltem(arr imagestwo[i 1], strDist[i I],
substrDist[i I ]);
row ltemstwo.add(item);

sickcatogorySpinner.setAdapter(new CustornListVicwAdapter(
DisasterDataForntthi s, R .layout.row, rowlternstwo));

II

else if (selectedDistrictdiscripter.equals("North_Ccntral_Province"))
strDist =new String[] "Anuradhapura", "Polonnaruwa" ;
String[] substrDist = "Anuradhapura", "Polonnaruwa" };
mt anHmagestwo [] = R.drawable.bul let triangle blue,
R.drawable.bullettriangl c_blue ;

row ltcmstwo = new ArrayLi st<Row ltern>();


for (mt ii = 0; ii < strDist.lcngth; 11 ++) {
Rowitem item = new Rowltem(arr imagestwo[i 1], strDist[i 1].
substrDislli 1]);
row ltemstwo.add(iteni):
sickcatogorySpi nner.setAdapter(new CustomListViewAdapter(
DisastcrDataFonmthis, R.layout.row, rowlternstwo));

else if (selcctcdDistrictdiscriptcr.equals('Southern_Province"))
strDist new String[] "Galle", "Matara", "Hambantota" };
String[] suhstrDist = "Galle", "Matara", "Harnbantota" ;
mt arr imagestwo[] = R.drawahle.bullet triangle_blue,
R .drawabl ebul let iriangi c_blue,
R.drawabl e.bullet triangl c_blue

rowltemstwo = new ArrayList<Row ltem>Q;


for (mt i I = 0; ii < strDist.length; ii ++) [
Rowitem item = new Rowltem(arr imagestwo[i 1], strDist[i 1 1,
substrDist[i I]);
rowltemstwo.add(itcm);

sickcatogorySpi nner.setAdapter(new Custom ListVi ewAdapter(


DisasterDataFormihis, R .1 ayout.row, rowltemstwo));

else i t (se!ectedDistrictdiscripter.equals("Easteni_Province")) {
strDist =new String[] "Trincomalee", "Batticaloa", "Ampara" J;
String[] suhstrDist = { "Trincomalee", "Batticaloa", "Ampara" };
nit air imagestwo[] = R.drawable.bullet triangle_blue,
R drawahle.hul let triangl c_blue,
R.drawahle.hullct triangle blue };

rowl tcmstwo = new ArrayLi st<Rowltern>()


for (mt il = 0; 11 < strDist.length; i I ++)
Rowltcni item = new Rowltcin(arr imagestwo[i I], strDist{i 1],
suhstrDist[i I j);
rOW ltenlStWo.add(itclTl);

sickcatogorySpinner.setAdapter(new CustomListViewAdapter(
DisasterDataForm.this, R.Iayout.row, rowltemstwo));

else if (selectec!Districtdiscripter.equals( "Central_Province"))


strDist =new String[] "Matale", "Kandy", "Nuwara Eliya" ;
String[] substrDist = { "Matale", "Kandy", "Nuwara Eliya"
mt arr imagestwo[] = { R.drawahle.hullct triangle blue,

lx
R.drawable.bullet triangle blue,
R.drawable.bullet triangle blue };

rowltcmstwo = new ArrayLi st<Rowltem>O;


for (mt ii = 0; ii < strDist.length; ii ++) {
Rowitem item = new Rowltem(arr irnagestwo[i I], strDist[i 1],
suhstrDist[i I]);
row Itemstwoadd(itcm);

sickcalogorySpinncr. sctAdaptcr(new Custom ListViewAdapter(


DisasterDataFonmthis, R. layout.row, rowltemstwo));

else if (selectedDistrictdiscriptercquals("North Western_Province"))


strDist =new String[] { "Puttalam", "Kurunegala" };
String[] substrDist = "Puttalam", "Kurunegala" }
mt arr imagestwo[] = R.drawable.bullet triangle_blue,
R drawahlc.hullet tn angl c_blue ;

rowltcmstwo = new ArrayLi st<Rowlteni>Q;


for (mt ii = 0; ii < strDist.length; ii ++)
Rowltcnl item = new Rowlteni(arr imagestwo[i 1], strDist[i 1],
substrDist[i I ])
rowlternstwo.add(item);

sickcatogorySpinncr.setAdaptcr(new CustoinListVicwAdapter(
DisasterDataFonn.this, R.layout.row, rowltcrnstwo));

else if (se!ectedDistrictdiscripter.equals( "Western Province"))


strDist =new String[] { "Gampaha", "Colombo", "Kalutara" ];
String[] substrDist = { "Gampaha", "Colombo", "Kalutara" };
ml arr imagestwo[] = { R.drawable.bullet triangl c_blue,
R.drawable.bullettriangl c_blue,
R.drawable.bullettriangl c_blue };

rowlternstwo = new ArrayLi st<Row I tern>Q;


tbr (mt ii = 0; 11 < strDist.length; ii --+)
Rowltenl item new Rowltem(arr imagestwo[i 1], strDist{i 1],
substrDist[i I]);
row llenistwo.add(iteni);

x
sickcatogorySpinner.setAdaptcr(new Custom Li stViewAdapter(
DisastcrDataForrn .this, R.layout.row, rowltemstwo));

else if (selectedDistrictdiscripter.equals("Saharagamuwa_Province'))
strDist new String[] 3, "Kegalle", "Ratnapura" };
String[] suhstrDist = { "Kegalle", "Ratnapura" ;
mt arr_imagestwo[] = R.drawahle.bul!et_triangle_hlue,
R.drawable.hullet triangle blue ;

row ltemstwo = new ArrayList<Rowltem>;


for (mt ii = 0; ii < strDist.length; ii ++) {
Rowltem item = new Rowltem(arr imagcstwo[i 1], strDist[i I],
substrDist[i I]);
rowl temstwo.add( item);

sickcatogorySpinnersetAdapter(new Custom ListViewAdapter(


Di sasterDataForm.this, R.layout.row, rowltemstwo));

else if (scicctcdDistrictdiscripter.equals("Uva_Province"))
strDist =new String[]{"Badulla", "Moneragala" };
String[] suhstrDist = { "Badulla", "Moneragala" }
mt air imagcstwo[] = R.drawable.hul let tn angle_blue,
R.drawable.bullet triangle blue ;

row ltemstwo = new ArrayList<RowItem>;


br (mt ii = 0; ii K strDist.length; i 1+-f)
Rowitem item = new Rowltern(arr imagestwo[i I ], strDisl[i 1].
substrDist[i I]);
row ltemstwo.add(itcm);

sickcatogorySpinncr.sctAdapter(new CustomListViewAdaptcr(
DisastcrDataForm this, R.layout.row, i'owltemstwo));

else
String[] stringstwo =
String[] suhstwo = { "
mt air imagcstwo[] = R.drawable.hullet triangle blue };

xi
rowltcrnstwo = new A rrayList<RowItem>;
for (mt ii = 0; ii <stringstwo.Iength; il++) {
Rowitem item = new Rowltern(arr imagcstwo[i 1], stringstwo[i 1,
substwo[i I]);
rowltemstwo.add(item);

sickcatogorySpinncr.setAdapter(new CustomListViewAdaptcr(
DisasterDataForm.this, R.layout.row, rowltemstwo));
}
}

@OvelTide
protected void onPause()
II TODO Auto-generated method stub
super.onPauseO;

locationManager.removeUpdates(this);

@Overri de
protected void onResume() {
II TODO Auto-generated method stub
super.onResumeO;

initilizeLocationListcning();

/1 Image
@Override
protected void onActivityResult(int requcstCode, mt resuitCode, Intent data) {
II TODO Auto-generated method stub
super onActivityResult(requestCodc, resuitCode, data);
System.out.println("onActivityresult");

if(requestCode == CAM_REQUEST)
try
Bitmap thumbnail = (Bitmap) data. getExtrasQ.get("data");

xii
//photolmageVi ew.setlniageBitmap(thurnbnai 1)
ii CALL THIS METHOD TO GET THE IJRI FROM THE BITMAP
Uri tcmpUri = getlrnageUri(getAppli cationContcxtQ, thumbnail);

/1 CALL THIS METHOD TO GET THE ACTUAL PATH


File finalFile = new File(getRealPathFromURl(templiri));
String pathnew = final Fil e.getAbsol utePathQ;
b = pathnew;
1/ pathTcxtVi ew setText(pathnew)
Systcm.out.println('Path :" + b);

catch (Exception e)
/1 TODO: handle exception
c.printStackTraceQ;

else{
b='NU LL";

public Uri get lrnageUri(Context inContext, Bitmap inlmage)


ByteArrayOutputStream bytes = new BytcArrayOutputStrearnO;
inlniage.cornpress(Bitmap.ComprcssFormat.J PEG, 100, bytes);
String path = lmagcs.Media.insertlmage(inContcxt.getContentRcsolvcrO,
inlmagc, flTiticu, null);

ret urn U ri parse(path);

public String getRealPathFromURl( Un un) {


Cursor cursor = gctContentResolverQ.query(uni, null, null, null, null);
cursor,moveToFirstO;
mt idx = cursor.getColumnlnclex(MediaStore.Images.lmageColunnns.DATA);
return cunsor.getStning(idx);
]/ I/image
@Oveiide
public hoolean onCreatcOptionsMenu(Menu menu)
getMenulnfi aterO. intl ate( R.rnenu.acti vity disaster data foni, menu);
return true;

public void onitemSelected(AdapterView<?> argO, View argi, mt arg2,


]ong arg3)
1/ TODO Auto-generated method stub
if(argO.getld() == R.id.sickcatogory spinner) {
selectedprovinceDescripter = strDist[arg2];
System .out.println( "(1istrict: "+scleetedprovinceDescripter);
loadAndDisplaydsd( scicctcdprovinceDescripter);

if (argO.getld() == R. id .gender spinner) {


/1 selectedGenderDescnptcr = GenderDescripter.get(arg2);
selected Distri ctdiscriptcr = strings[arg2];
1/ selecteciGenderPosition = arg2;
Systcm.out.println("GEN DER :" + selectedDistrictdiscripter);
System .out.println(selccte(IGenderDescripter);
loadDistrictO;

if (argO.getld() == R.id.disasterspin) {
/1 selectedGenderDescripter = GenderDescripter.get(arg2);
selectedDisasterDescripter = stringsDisaster[arg2];
// selectedGendcrPosition = arg2;
Systcrn.out.println("Disaster :" -I- selectedDisaslerDescripter);
/1 System out.pri ntln(selectcdGcndcrDescripter);

if (argO.getld() == R.id.dsdspiner) {
selectedDSDDescripter = dsd.get(arg2);
System.outprintln("DSD :"+selcctcdDSDDescripter);

public void onNothingSelected(AdapterView<?> argO)


II TODO Auto-generated method stub

public void onClick( View v)


/7 TODO Auto-generated method stub

xlv
if(v.getld() == R.id.date button)
show DatePopupQ;

if (v.getld() == R.id.photo)

Intent cameraintent = new Intent(


android.provider. MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraintent, CAM REQUEST);

else
System out. println( !b H- b);

if(v.getld() == R.id.save_button)

System.out.println("b + b);
if (checkFieldErnptyO)

DenguData disasterdbData = new DenguDataO;


disasterdbData.setPationN ame(affectpeopleedittect.gctTcxtQ.toStringO);
disasterdbData.setPationNIC(afftctfami1yedittext.(,,ctTcxtO.toStringO);
disasterdhData.setAgc(affcctdeathcdittext.getText.toStringQ);
disastcrdhData.sctSickcategory(selectedprovinceDcscripter);
disasterdbData.sctGender(selccte(IDistrictdiscripter);
disasterdbData.setLatitude(Douhlc.toStnng(loc.Iatitude));
di sasterdbData.set Longit udc( Double.toString( joe. longitude));
disasterdhDatasctCurrentdate(givcDatcO)
disastei-dhDala.sctProvincc(selectedprovinceDcscripter);
disasterdbData.setDistrict(selectcdDistnctdiscripter);
disastcrclbData, setDsd(selectedDS DI)cscripter);
disasterdbData.setDisaster(selectcdDisasterDcscriptcr);
disastcrdhData.sctAffectedDeath(aI!cctdcathedittcxt.getText( ).toStringO);
disasterdhData.setA flectedfamily(affectfamilyedittext.getTextO.toStringO);
disasterdbDatasctAUectedlnured(injurcdEditetext.getfextQ.toStringQ);
disasterdhData.setA ffectcdMissing(misingEdittext.getTextO.toStringO);
disasterdbDatasetAffctedPcoplc(affectpeopleedittcct.gctTcxtQ.toStringQ);
disastcrdbDatasetDamagelully(fullyEittcxt.getTextQ.toStringQ);
disasterdhDatasetDamagePartialy(partialyEdittext.getTcxtO.toStringO);
disasterdhData.setNos(safelocEdittext.getText.toStringQ);

xv
disasterdbData.setSafefmily(farnilyNosEdittext.getTcxtQ.toString);
disasterdhData.setSafeperson(safepeopleEdit1ext.getTcxtQ.toString);
disasterdh Data. set lmagepath(b);
disasterdh Data. set lnfccteddate(dateButton. getTextQ.toStringO);
1/ dengudh Data. setHouscno(housenoEditText.gctTextQtoStringO);
di sasterdb Data. set H ouseno( "00");
disasterdhData.sctGnd(gnd EditText.getTextQ.toStringQ);
disasterdhData.sctlnicino(getimei(this));
if(b.trim.equalslgnorcCase("NULL")) It
disasterdhData.setPhoto("null");
}clsc{
d isasterdb Data. set Photo( h);

//disasterdhData. set Photo(h);


saveToDb(disastcrdbData);

I
1/ ///velidation
private boo] can check FieldEmpty() {
if(affectfawilye(liltext.getText.toStringQ.equals(""))
AlcrtDialog.Builder builder = new AlertDialog.Builder(
DisasterDataForm .thi s);
builder.sctTit]e("Empty F'icld")
.setMessage('lD Field Empty")
.sctCancclable(fhl se)
.seticon(R.drawable. iconflood)
,setNegativeButton( "OK",
new Dial og]ntcrface.OnC]ickListcner()
public void onClick(Dialoglntcrface dialog,
mt id)
affctfarni] yedittcxt.sctFocusablel nTouchMode(true);
affectfarnilyedittcxt,requestFocusQ;
dialog.cancelO;

xvi
AlertDialog alert = builder.createO;
alert.showQ;

else if (affectpcopleedittect.getText(JtoStringO.equals(")) {
AlertDialog.Builder builder = new AlertDia!og.Builder(
DisasterDataForm.this);
buildcr.setTitle("Empty Field?)
.setMessage( "Name Field Empty")
setCancclable(fiilse)
seticon(R.drawable. icon flood)
setNcgativeButton("OK",
new Dialoglnterface.OnClick Listener()
public void onC!ick(Dialoglnterface dialog,
ml id)
affcctpcopleedittect.setFocusablelnTouchMode(true);
affectpeopleedittect.requestFocusO;
dialog.cancel();

k \.
AlertDialog alert = builder.crcatcO;
alert. showQ;

else if (affcctdeatliedittext.getTcxt,toStringO.equals("))
AlertDialog.Builder builder = new AlcrtDia!og.Buildcr(
DisasterDataForm this);
huildcr.setTit!e("Ernpty Field")
sctM essage(" Age Field Empty")
setCancelablc(false)
.scticon(R.drawable.iconflood)
.setN egativeButton("OK",
new Di aloglnterface.OnClickLi stcner() {
public void onClick(Dialoglntcrface dialog,
mt id)
affctdeathedittcxt.setFocusablelnTouchModc(true);
af!ctdeathcdittext.requestFocusQ;
dialog.cancelQ;

AlertDialog alert = builder,createO;

xvii
alert.showQ;

cisc if (i nj uredEditctext.getText.toStringO.equais(")) {
AlertDialog.Builder builder = new AlertDialog.Builder(
DisasterDataFomi .this);
builder.setTitic("Ernpty Field")
.setMcssagc("Gnd Field Empty")
.setCancel able( false)
.seticon(R.drawable.iconfiood)
.setNegativcButton("OK",
new Di aloglnterfacc.OnCl ickListener() {
public void onClick(Dialoglnterface dialog,
lilt id)
injured Editetext.sctFocusahlelnTouchMode(true);
injuredEdi tetext.rcquestFocusQ;
dialog, cancel 0;

AlertDialog alert = huildcr.create0;


alert.showQ;

else if (dateButton .getText( ).toStringQ.ecuals("))


AlertDialog.Builder builder = new AlertDialog.Builder(
DisastcrDataFonn.this);
buildcr.setTitle("Empty Field")
.sctMessage("Click on Date")
setCancel abl c( fat se)
seticon(R.drawahle. fire)
setNegativeButton("OK".
new Di aloglnterfaee.OnClickListencr() {
public void onClick(Dialoglnterface dialog,
mt id) it
dateButton .setFocusablelnTouchMode(true);
dateButton.requestFocusQ;
dialog.cancelQ;

A]ertDialog alert = builder.createO;


alcrt.showQ;

xviii
else if (locationTextVicw.getTextQ.toStringQ.equals(")) {
AlertDialog.Builder builder = new AlertDialog.Builder(
DisasterDataFonmthis);
builder.setTitle("Ernpty Field")
setMessagc(
"Please restart the programe to aquire the location")
setCancelablc(fal Se)
seticon(R.drawab!e.iconflood)
setNegativeButton("OK",
new Dialoglntcrface.OnCl ickListener() {
public void onClick(Dialoglnterface dialog,
intid)
locationTextView
setFocusablelnTouchMode(true);
locationTextVicw.requestFocusQ;
dialog.cancelO;
fini shO;
}
I);
AlertDialog alert = builder.createQ;
alert.showQ;

} else
System.out.println("True");

return true;

System.out.println(" False");

return false;

public void onLocationChanged(Location location) {


1/ TODO Auto-generated method stub
bc = new LatLng(location.getLatitudeQ, Iocation.getLongitudeQ);

xix
locationManager.removelJpdates(DisasterDataForrn .this);
locationTcxtView.setText( Double.toString(loc.latitude) +"
+ Double.toString(loc.longitudc));
progressDi alog.dismi ssQ;

public void onProviderDisablcd(String provider)


// TODO Auto-generated method stub

public void onProviderEnahled(String provider)


// TODO Auto-generated method stub

public void onStatusChanged(String provider, mt status, Bundle extras) {


/1 TODO Auto-generated method stub

I/function
pr vate void showDatePopup()
/1 Add layout to POPUP
Layout I nfiater layoutlnfl ater = (Layout Infiater)
getSystemService( LAYOUT_IN FLATERS ERV ICE);
final View dateOIlncidentView = layoutlnfiater.inflate(
R .layout.date_pi cker_popup, null);
AleriDialog. Builder builder = new AlertDialog.Builder(this);
huilder.setView(dateOfl nciclentView);
bui lder.setM essage("Sel ect Incident Date");
builder.setCaneelable(false);
hui I der. setPositi veB utton( "Done",
new Dialoglntcrthce.OnClick Listener()
public void onClick(Dialoglnterface dialog, jut which) {
1/ TODO Auto-generated method stub
DatePicker dateOfincldentdatePicker = (DatePicker) dateOflncident View
!indViewByld(R.id.dateofineident_datcPicker);
mt dayOfMonth = dateOflneldentdateP icker

xx
getDayOfM onthQ;
mt month = dateOtincldentdatePicker.getMonthO;
month = month + I
mt year = dateOfincldentdatePicker.getYearO;
dateButton.sctText(year + "-" + month + "-"
dayOfMonth);

U;
AlertDialog alert = builder.creatcQ;
alert.show();

public String givcDate() I


Calendar cal = Calendar.getlnstanceO;
Simpi eDateFormat sdf = new SimpleDateFormat("yyyy/MM/(Id");
return sdf. format(cal .getTi meO);

private void saveToDb(t'inal DenguData dengudata)


progressDialog = new ProgressDialog(this);
progressDialog.sctTi tle(" Save Data On DB");
progrcssDialog.setMessage( "Save is Progress");
progressDia1og.slo'();
try
DbHelper dbHel per = new DhHelper(DisasterDataFonmthis);
SQLiteDatahase (lb = dhHclper.openDataBaseQ;
db.beginTransactionO;
ContentValucs data = new ContentValuesO;
data.put( "currentdate", dengudata.getCurrentdate);
data.put( "infecteddate", dcngudata.get InfecteddatcO);
data.put(" catagory", dengudata.getSickcategoryQ);
data.put( "lat", dengudata. getLatitudeO);
data.put("lon", dengudata.getLongitudeO);
data.put("narnc", dcngudata.getAffectedPeopleO);
data.put("nic", dengudata.getA ffectcd farni lye);
data.put( "age", dengudata.getAftcted_DeathQ);
data.put("sex", dengudata.gctGenderQ);
data.put("gnd", dengudata.getGnd);
data.put("houseno", dengudata.getHousenoO);

xxi
clata.put("irneino", dengudata.getlmeinoQ);
1/
data.put("safe_person", dengudata.getCurrcntdateO);
data.put("safe_famil y", dengudata.getln tcteddatcO);
data,put("nos", dengudata.getS ickcategoryO);
data.put("damage_partialy", dcngudata.getLatitudeQ);
data.put( "damage fully", dengudata.getLongitudeQ);
data.put( "missing", (lcngudata.getPationN ameO);
data.put("injured", dcngudata.getPationNICO)
data.put( "disaster", dcngudata.getAgcQ);
data.put("dsd", dengudata.getGenderO);
data.put("district", dengudata.getGndQ);
data.put("province", dcngudata.getHousenoQ);
data.put("injured", dengudata.getPationNlCO);
data.put("disaster", dengudata.getAgeQ);
data.put("dsd", dengudata.getGenderO);
data.put( "district", dengudata.gctGndQ);
dala.put( "province", dengudata. getHousenoQ);
//data.put(" imeino", dcngudata.getlmeinoQ);
// photo
data.put("image", dengudata .getPhotoQ);

data.put("scnt", 0);
long id = db.insert("dengudctail". null, data);
dh.sctTransactionSuecessfuiO;
dh.cndTransactionQ;
(lb. ci osc);
Toast.makeText( DisastcrDataForm.this, "Data Saved in Local DB",
Toast. LENGTH LONG).showQ;
dengud ata . set ld(i d);
if
(NetworkChecklitil Disaster.isConnected(thi s)) {
ServerCoinmunicatorDisaster serverConi = new ServerCommunicatorDisasterQ;
serverCorn. addSitRep(dengudata, this);

progressDialog.disrnissQ;
/7 Yes no
AlertDialog.Builder builder = new AlertDialog.Builder(
DisasterDataFonn .thi s);
builder.setTitle( "Close Project")
.setMessage("Do you want to Enter another record?")
.setCancclable(false)
.seticon(R.drawable.mosquito)
.setPositiveButton("Yes",
new Dialoglnterface.OnClickListener() {
public void onClick(Dialoglnterface dialog,
mt id) {
clearFieldQ;
dialog.cancelQ;
}

.setNegativeButton("No",
new Dialoglnterface.OnClickListener() {

public void onClick(Dialoglnterface dialog,


mt which) Ik
II TODO Auto-generated method stub
dialog.cancelQ;
fin I shO;

AlertDialog alert = builder.createO;


al cii. show();
1/

} catch (Exception e) {

II TODO: handle exception

1/ clear data
private void clearField() {
affectpeopleedittect. sctText(");
affectfamilyedittext.setText(");
affectdeathedittext.setText(");
dateButton.setText(");
housenoEditText.setText(");
gndEditText.sctText("");

show result
private void showResult() {
class CustomAdapter extends BascAdapter {

public mt getCount()
/1 TODO Auto-generated method stub
return dengudatagnd.sizeQ;

public Object gctltern(int argO)


1/ TODO Auto-generated method stub

return dengudatagnd.get(argO);

public long getltemld(int argO) {


1/ TODO Auto-generated method stub

return 0;

public View getView(int argO, View view, ViewOroup arg2)


II TODO Auto-generated method stub
Layout Infiater I = (Layoutlnfl ater) getSystemService( LAYOUT INFLATER_S ERVICE);
view = l.infiate(R.layout.contact row, null);
final Gnd gri = dengudatagnd.get(argO);
final TextView telephoneTextView = (TextView) view
.findViewByld(R.id.tpnurnher_textview);
telephoneTextViewsetText(gn.gctGn(iQ);
gnd ListView.setOnitemCl ickListcncr(new On ltemCli ck Listener() {
public void oniternClick(AdaptcrVicw<'?> argO, View argl,
mt arg2, long arg3) {
System.out.println("Arg 0:" -I- argO + Arg2 :" -F arg2);
/1 TODO Auto-generated method stub
Ii gndEditText.setText(gn getOndQ);

xxiv
String gndnam e = strgndname get(arg2);
gndEditTcxt.setText(gndname);
gnd Li stView.setVisibil ity(View.GONE);

return view;

CustornAdapter c = new CustornAdapterQ;


gndListView.sctAdapter(c);
}

private void search(String search) {

try
gndListView.setVisibility(View.VISIBLE);
dengudatagnd .clearQ;
strgndnarnc.clearQ;
DbHelper dbl-lelper = new DbHelper(this);
SQLiteDatabase db = dbHelper.openDataBascO;
String where =
String whereArgs[] = search.split("
for (mt i = 0; i < whereArgs. length; i++) It
whereArgs[I] hI%?1 + whereArgs[l] + "%";
=

if(wherc.lcngth() > 0) {
where += "AND gndnarne like ?";
else {
where = "gndname like '1";

System .out.println("Where" + where);


Cursor c = db.query("gnd", null, where, whereArgs, null, null,
"gndnamc");
while (c.moveToNextQ) {
/1 mt id = c.getlnt(0);
String gndname = c.getString( I);
Ond Ct = new GndO;

xxv
/1 ct.s(id);
ct.setGnd(gndnarne);
dengudatagnd. add(ct);
strgndname.add(gndname);
}
c.closeO;
db.closeQ;
dbHelper.close;
//showResultQ;
} catch (Exception e) {
e.printStackTraceQ;

I//load dsd

private void loadAndDisplaydsd(String selectedcornmand) {


dsd clearO;
dsdlist.clearQ;
dsd.add("DSD");
String[] whereArgs = new String[l];
II
whereArgs[O] = sel ectedcornmand toUpperCaseO;
System .out.println("District : "+whereArgs[O]);

try
dsdlist.add(new DsdO);
DbHelper dhHelper = new DbHelper(this);
SQLiteDatabase db = dbHelper.openDataBaseO;
/1 This is for where close
Cursor c2 = null;

c2 = db.query("dsd", null, "District = ?", whereArgs, null, null,


null);

while (c2.rnoveToNextQ) {
mt id = c2.getlnt(3);

xxv'
String distrct = c2.getString(0);
String dsdst = c2.getString(2);

Dsd ba = new DsdO;


ba.sctld(id);
ba.sctDistrict(distrct);
ba.sctDsd(dsdst);
1/ add data to list array "contact" type
dsdlisLadd(ba);
Il//add data to list array "String" type
dsd.add(ha.gctDsdQ);

c2.closeO;
db ci oseO;
A rrayAdaptcr<Stri ng> baseAdapter = new ArrayAdapter<String>(this,
an(iroid. R.layout.sirnple spinner_item, dsd);
II haseAdapter
1/ .sctDropDownViewResource(android.R.layout.sirnpie_spinner_droPdOWfl_item)
dsdspin.setAdapter(baseAdaptcr);

catch (Exception e)
c.printStackTraceQ;

///close load dsd

1/ End show result


II End Project GISDA CRD project
public String getimei(Context context)
TelcphonyM anager tel ephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SER VICE);
return tclephonyManager.gctDeviceld;

// II

xxv"
Sync Manager

package lk.defence.dir.util,

import javautil.ArrayList;
import java.utiLList;

import lk.dcfence.dir. Sei-vcrCominunicatorDisastcr;


import lk.dcfence.dir.dh.DhHelper;
import lk.defence.dir.pojo.DenguData;
import android.contcnt.Context;
import android.datahase.Cursor;
import android.datahase.sql ite. SQLiteDatabase;

public class SyncManagerDisaster


public void sync(Contcxt context){
//serch db content
try {

DbHelper dhHelper = new DhHelper(context);


SQLiteDatabase db = dhHelper.opcnDataBaseQ;

Cursor c = null;

String[] whcrcArgs = new String[ I ;


whcreArgsO] =

c = db.qucry("dengudctail", null, "sent ='?", whereArgs, null, null, null);

ScrvcrCommunicatorDisaster serverCommunicator = new ServerCommunicatorDisasterO;

List<DenguData> denguDatasymanger = new ArrayList<DenguData>O;


while (c.moveToNextQ)
mt id = c.getlnt(c.getColumnlndex("id"));
String patName = c.getString(c
.getColurnnlndex("narne"));
String patNic = c.getString(c
getCo I uiin Index ( "n ic'));
String patcatogory = cgetString(c.getColurnnlndex( "catagory"));

String patgender = c.getString(c.getCol umn lndex("sex"));


String image = c.gctString(c.getColumnlndex("image"));
System .out.println("Imagc path "-i-image);
String patage=c.gctString(c.getCol unin Index( "age"));

xxviii
String patimcino=c.getString(c.getColumn!ndex("imeino"));
Stri rig patGnd=c.getString(c.getColumn lndex( "gnd")):
String pati louseno=c.getString(c.getColumn lndex("houseno"));

String patlnfectdate=c,getString(c.getColurnnlndex("infecteddate"));
String patcui-renidate=c.getString(c.getCoumnlndex("currentdate"));
String patlatitude = c.getString(c.getColumnlndcx('lat"));
String patlongitude = c.getString(c.getColumnlndcx("lon"));
String disaster province = c.getString(c.(,etColumnlndcx("province"));
String disaster district = c.getString(c.getColuninln(lex(t district));
String disaster dsd = c.getString(c.getColumnlndex(T'dsd'));
String disaster disaster = c.getString(c.gctColuinnlndex("disaster"));
System.out.println(tDisaster'+disaster_(Iisaster );
String disaster_afect_family = c.gctString(c.getColumnlndex("nic"));
String disaster afect_people=cgetString(c.getColumnlndex(narnc));
String disaster afect death=c.getString(c.(,etColumnlndex("age"));
String disaster afect inj ured=c.getString(c.getColumnlndcx("injured"));
String disaster afect missing=c.getString(c.getColumnlndex("missing")):
String disaster damage fully=c.getString(c.getColumnlndex( (1amage_fully )),
String disaster damagepartialyc.getStnng(c.getColumnlndex(damage_partialy));
String disaster_sal_nos=c.getString(c.getColurnnlndex("nos"));
String disaster safe larnily=c.getString(c.getColumnlndex( safe family )),
String disaster safe_person=e.getString(c.gctColumnlndexCsafe_persOfl"));
/1
DenguData disast = new DenguDataO;
eli sast. set I d( id)
disast. selPationNarne( disaster ateci people):
disasLsciAftectedPeople(disasteraiect_people):
disasi.sctPationN IC(disastcraf'cctthnuily):
disast.setAffectcdfamily(disasterafcct family);
disast.setProvince(disastcr province);
disast.setDistrict(disaster district);
disast.setDsd(disasterdsd);
disast.setDisaster(disaster disaster);
disast.setAffectedlnjured(disasterafect_injured);
disast.setA iieetedDeath(disasterafectdcath);
disast.setAfictedMissing(disaster_afect_missing);
disast.setDamagefully(disaster_damage_fully);
disast.setDamagePartialy(disaster_damage_partialy);
disast.sctSal thmily(disaster safe family):
di sast.setSaf e_person(di saster safe person);
disast.setNos((Iisaster safe nos);
elisast.setSickcategory(patcatogory);
disast.setLatitude(patlatitude);
disast set Longitude(patlongitude);
disast.setGendcr(patgender);
disast.setlnfecteddate(patlnfcctdate);
disast . setCurrentdate(patculTentdate);
di sast.setAgc(d isasterafect_death);
di sast . setA ffected Dcath(di saster afect death);
disast.setlrneino(patirneino);
disast.setHouseno(patHouseno);
disast.sctGnd(patGnd);
disast.sctPhoto(irnage);

//sitrcp . set
denguDatasyrnanger.add(disast);

IIcolse the !Cursor c =db.query


c.closeQ;
db.closeO;

for (DenguData dengu: denguDatasyrnanger) {


serverCornmunicatoraddSitRep(dcngu, context);

catch (Exception e) {
e.printStackTraceO;

II

Network Utility checker

package lk.defnce.dir.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Networklnfo;

public class NetworkChcckUtilDisaster {

public static boolean isConnected(Context context) {


boolean islnternetAvailable = false;

xxx
System .out.println("println network uti I class fired")

ConnectivityManager cm = (Conncctivi tyM anager) context


.getSystemServi cc(Context.CON N ECTI VITY SERVIC E);

Networklnfo wifiNetwork = cm
.getN etworklnfo(ConncctivityManager.TYPE_WI Fl);
if(witiNetwork null)

islnternetAvailable = wifiNetwork,isCorinectedO;

Networklnfo mobileNetwork = cm
.getN etwork Info(ConnectivityManager.TYPE_MOBILE);
if(mobileNetwork 1= null) {
//islnternetAvailahle = mobileN etwork.isConnectcdOrConnectingQ;
islnternetAvailable = mohileN etwork. isConnectedO;

Networklnfo activeN etwork = cimgetActivcN ctworklnfoO;


if(activeNetwork != null) {
islnternetAvailabic = activeN ctwork.i sConnectedO;

return isinternetAvailable;

Database Connection Class

package lk.defence.dir.dh;
import java. io. FileOutputStream
import java. io. lOExcepti on;
import java.io.lnputStream;
import java.io.OutputStream;
import android.content.Context;
import android .database. SQ LException;
import android .database. sql ite. SQ LiteDatahase;
import android.databasc.sqlite.SQLiteExceptiom
import android database. sqlite. SQ LiteOpenH el per;

public class DhHelper extends SQLiteOpenl-lelper


private static String dbnarne = "dengu";
private static String dhpath = "/dataldata/lk.defence.dir/datahasesl"
private Context C;
private SQLiteDatabase myDataBase;
public DbHelper(Contcxt context) throws lOException {
super(context, (Ibnarne, null, 1);
// TODO Auto-generated constructor stub
this.c = context;
createDataBaseD;

public void createDataBase() throws lOException

hoolean dhExist = checkDataBaseQ;


if(dbExist) {
1/ do nothing - database already exist
else
this .getR cad ab I eDatabaseO;
try
copyData BaseQ;
catch (lOException c)
throw new Enor("Error copying database");

private hoolean checkDataBase()


I/File dbFi le=ncw File(dhpath+dbname);
//return dbFilc.cxistsO;
SQLitcDatahase chcckDB = null;
try
String myPath = dhpath + dbnarne;
chcckD B = SQLitcDatabase.opcnDatahase(myPath, null,
SQLiteDatahase.OPENREADON LY);

catch (SQLiteException c) {
1/ database does't exist yet.

if(checkDB != null) {
checkDB.closeQ,

return checkDB != null ? true: false;

private void copyDataBase() throws TOException {

/1 Open your local db as the input stream


InputStream mylnput = c.getAssetsQ.open(dbname);

7/ Path to the just created empty db


String outFileName = dhpath -I- dhname;

II Open the empty dh as the output stream


OutputStream myOutput = new Fil eOutputStrearn(outFileName);

/7 transfer bytes from the inputfile to the outputfile


hyte[] buffer = new byte[ 1024];
mt length;
while ((length = mylnput.rcad(buffer)) > 0) {
myOutput.writc(buffer, 0, length);

/7 Close the streams


myOutput.flushO;
myOutput.closeQ;
myl nput.cl oseO;

public SQLiteDatabase openDataBase() throws SQLException {


/7 Open the database
String myPath = dbpath + dbname;
myDataBase = SQLiteDatabase.opcnDatabase(rnyPath, null,
SQLiteDatabase.OPEN READ WRITE);
return myDataBase;

@Override
public synchronized void close()
if(myDataBase null)
m yDataB ase.cl oseQ;
super.closeQ;

@Ovei-i-i de
public void onCreate(SQLiteDatahase (Tb) {

@Override
public void onUpgrade(SQLiteDatabase dh, mt old Version, mt newVersion)

Server Communicator Class

package lk.defence.dir;
import j ava.io. BufferedReader;
import java.io. ByteArrayOutputStream;
import java.io.lnputStream;
import j ava.io. lnputStrcam Reader;
import java.util.ArrayList;
import java.util.List;
import 1k .defence.dir.db.DhH elper;
import lk.defence.dir.poj o. DenguData;
import org.apache.http. 1-1 ttpResponse;
import org.apache.http.NameValucPair;
import org.apache.http.client.HttpClient;
import org.a1)ache.htt)C1iei1t.Cfltity.Url EncodedFonnEntity;
import org.apache.http.cli cnLmethods. HttpPost;
import org.apachc.http.impl.client.DefaultHttpClient;
import org.apaclie.http.iiiessage.BasicNai-neValuePail-;
import andl-oi(Lcontent.ContentValues;
import android. content. Context;
import android.datahase.sqlitcSQLiteDatabase;
import android.gi-aphics. Bitmap;
import android.graphics BitmapFactory;
import android .os.AsyncTask;
import android.util.Base64;
import android.widget.Toast;

public class ServerCommunicatorDisaster fk


String encodedimage;

public void addSitRep(final DcnguData distData final Context context)

class l-lttpAsyncTask extends AsyncTask<Void. Void, String>

OvciTidc
// Same as Run method on Thread
protected String do InBackground( Void... pararns)
1/ TODO Auto-generated method stub
String result = null;
try It
HttpPost httpPost = new HttpPost(
"http://slrider.com/sitrepphp");
System .out.println("Sick Catagary
disiData.getSickcategoryQ);
System.out.pri ntln( "1 nfectcd Date:"
distDaia.gctlnfccteddate() "name
+ distData.getPationName() + "age
+ distData.getAge() + "Catergory :"
+ distData.gctSickcategory() + "Latitude:

xxxiv
+ distDatagetLatitude() +" sex :"
+ distData.gctGencler() + "Longitude
+ distData.getLongitude() + " NIC :"
+ distData.getPationNlC() + " house no
+ distData.gctHouseno() -I- "GND
-F distData.getGnd() + "IMEINO
+ distData.gctlmeinoO);
System.out

Systcm.out.println("provincc " + distData.gctProvince()


+ " Distict :" + distData.getDistrict() + " DSD
+ distData.getDsd() + " Disaster
+ distData.getDisaster() + " Deth
-I- distData.getAffected_Death()
+" Affected Family :"
F distData.getAffectcd family() + " All Injurd
+ distDatagetAffected lnjurcd() + " Latitude
- distData.getLatitude() Longitude
+ distData.gctLongitude() + Image path
-F distData.getlmagcpath() + " Date
+ distDala.gctCulTcntdate() -F " Missing
-I- distData.getAffectcdMissing()
+ " Affcted people :"
+ distData.getAffectedPeoplc() +" Damage fully
+ distData.getDamage_fullyQ+" Damage partialy :" + distData.getDamagePartialy);
System.out

List<NarneValuePair> data = new ArrayList<NameValucPair>;


data.add(new BasicNameValuePair("datc of incident', distData.getCurrentdateQ));
System.out.println("Sick Catagary
+ (listData.getSickcategoryO);
data.add(new BasicNameValuePair("province", distData.getDistrict));
data.add(new BasicNameValuePair("district", distData.getProvincc));
data.add(new BasicNameValuePair("dsd", distData.getDsdQ));
data.add(new BasicNameValuePair("dis type", distData.getDisasterQ));
data.add(new BasicNarneValuePair("latitude", distData.getLatitudcQ));
data.add(new BasicNanieValuePair("longitudc", distData.getLongitudeQ));
data.add(new BasicNarncValuePair("aff_family", distData.getAffected_familyQ));
data.add(new BasicNameValuePair("aff people", distData.getAffectedPeople));
data.add(new BasicNameValuePair("aff death", distData.getAffectedDcathQ));
II ineino
data.add(new BasicNameValuePair("iemi", (listData

xxxv
.gctlmeinoQ));
7/ imeirio
data.add(new BasicNameValuePair("gnd", distData.gctGndO));
if (distData.gctPhotoO.toStringQ.equals("flull))
data.add(new BasicNameValuePair("image't, "NULL"));
else
7/Bitmap image = BitmapFactory.decodeFile("assets/lcons/android/drawable-
rndpi/niark.png");
Bitmap image = BitniapFactory.decodeFile((listData.getPhotoO);
BytcArrayOutputStrearn stream = new ByteArrayOutputStream(
1 0240);
image.compress(Bitmap.CompressFormat.JPEG, 95, stream);
byte[] bytelmage = stream.toBytcArrayO;
encodedi mage = Base64.encodeToString(bytelrnagc,
Base64. DEFAULT);
System.out.println("IMAGE :" + encodeclimage);

data.add(new BasicN ameValuePair("image",encodedimage));

httpPost.setEntity(new U rlEncodedForrnEntity(data));
FlttpClient httpClient = new DcfaultHttpClientQ;
HttpResponse httpResponse = httpCl ient.execute(httpPost);
I nputStream i nputStream = httpResponsc.getEntity()
getContcntQ;
BufferedReader bufferedReader = new BuffcredRcader(
new I nputStreamReader(inputStream));
StringBuilder respose = new StringBuilcicrQ;
String responselinc = null;
while ((responseline = buffere(fReader.readLineQ) != null)
respose.appcnd(responseline);

buffBredReadercloseO;
inputStreani .closeQ;
result = resposc.toStringQ;
catch (Exception e)
/1 TODO: handle exception

retuni result;

@OvclTide
protected void onPostExecute(String result)
7/ TODO Auto-generated method stub
super.on Post Execute(result);
System.out.println("Resu!t :" + result);
if(rcsuJt != null && result.cquals("success")) {
try {
System.ouLprintl n("Infected Date:"
+ distData.getlnfectcddate() + 'name
+ distData.gctPationNarnc() + "age
+ distData.getAge() + "Catergory
+ distData.getSickcatcgory() + "Latitude:
-F distData.gctLatitude() +" sex :"

+ distData.getGcnder() + "Longitude
+ distData.getLongitude() + "NIC :"
+ distData.gctPationNlC() + "IMEINO :"
+ distData.getlmeinoQ);
DbHelper dblIelper = new DbHclper(context);
SQLiteDatabase db = dhH elper.openDataBaseQ;
db.beginTransactionQ;
String[] whereArgs = new String[ I];
whereArgs[O] = " + distData.getldQ;
ContentValues data = new ContentValuesQ;
data. put("scnt", 1);
db.update( "dengudctail", data, "id=?", whereArgs);
db.setTransactionSucccssful 0;
db.endTransaction();
db.close0:
Sysiem.out.println(whcreArgs[O]);
Systern.out.println("Edit Record");
Toast.makeText(contcxt, "Disaster Data Send to Server",
Toast. LENGTH LONG).show0;
catch (Exception e)
c.printStackTracc0:

I-lttpAsyncTask httpAsyncTask = new HttpAsyncTaskQ;


httpAsyn cTask . executcQ;

Connectivity Broadcast Receiver

package lk.defcncc.dir;
import java.util.List;
import 1k .dcfence.dir. util .SyncManagerDisaster;
import android. app.Acti vityManager;
import android.app.ActivityM anager. RunningTask Info;
import android.content.BroadcastReceiver;
import android.content.ComponentN ame;
import android.content.Context;
import android.content. Intent;
import an(lrOid .net.ConnectivityManager;
import android.widget.Toast;

public class ConnectivityBroadcastReceiverDisastcr extends BroadcastReceiver {


public ConncctivityBroadcastReccivcrDisaster()
System.out.println("CBR ConnectivityBroa(icastReceiver constructor");

@Overridc
public void onReceive(final Context context, Intent intent) {
boolean noConnectivity - intciit.gctBoolcanExtra(
ConnectivityManagcr.EXTRA_NO_CONNECTIVITY, false);
System.out.println("CBR ConncctivityBroadcastReceiver constructor"-1-
ConnectivityMana(,,,er,EXTRA EXTRA_INFO);
if (noConncctivity)
Toast.makeText(context, "Disaster No Connection", Toast.LENGTHLONG).showQ;
System.out.printl n("No Connection");

else
Toast.makcText(context, "Disaster Connected", Toast.LENGTHLONG).showQ;
System .out.println( "Connected");
SyncManagerDisastcr syncn]aneger=new SyncManagcrDisasterQ;
syncmanegcr.sync(context);

public hoolean isAppi icationSentToBackground(final Context context)


ActivityManager am = (ActivityManager) context
.gctSysternService(Context.ACTIV ITY S ER VICE);
List<RunningTasklnfo> tasks = am.getRunningTasks(l );
if(!tasks.isEmpty)
ComponentN arne topActivity = tasks.get(0).topActi vity;
if (!topActivity,getPackageNamc.equals(contcxt.gctPackageNameQ))
return true;

return false;

You might also like