Sei sulla pagina 1di 42

FINAL YEAR PROJECT REPORT

An Android Application For Pothole Detection


Barry Kennedy Computer Systems 0655694
Supervisor: Joe Griffin

Contents
Acknowledgements .......................................................................... 4 Abbreviations .................................................................................. 5 Project Summary ............................................................................. 6 Introduction .................................................................................... 7 Project Background ...................................................................... 7 Overview ...................................................................................... 7 Motivation .................................................................................... 8 Objectives .................................................................................... 9 Development Requirements........................................................... 9 Other Resources ........................................................................... 9 Issues the needed to be considered.............................................. 10 Report Contents ......................................................................... 10 Preparation ................................................................................... 11 Android Development ................................................................. 11 History ................................................................................... 11 Architecture ............................................................................ 11 Application Framework ............................................................ 12 Existing applications .................................................................. 13 Pothole agent .......................................................................... 13 Street bump ............................................................................ 14 Overall impressions ................................................................. 14 Photo driven applications......................................................... 14 Similar Research Projects ........................................................ 15 Development Requirements......................................................... 15 Requirements Analysis .................................................................. 17 Identifying User Requirements .................................................... 17 Use Case Diagram ...................................................................... 17 Flowchart................................................................................... 18

Class Diagram............................................................................ 19 Screen Mock ups ........................................................................ 19 Development ................................................................................. 20 Accelerometer ............................................................................ 20 How it works ........................................................................... 21 Displaying the information ....................................................... 22 Location ..................................................................................... 24 Challenges .............................................................................. 25 Displaying the information ....................................................... 25 User Interface/Splash................................................................. 26 Event log/database .................................................................... 26 Testing....................................................................................... 27 Overall Development ................................................................... 27 Conclusions .................................................................................. 29 Review of objectives .................................................................... 29 Project Schedule ......................................................................... 30 Communication with Supervisor ................................................. 30 Scope for future work ................................................................. 30 Bibliography ................................................................................... 4 Appendences ................................................................................... 6

Acknowledgements
I would like to acknowledge the help, support and inspiration of the following My supervisor Joe Griffin and my second reader Ita Richardson for their on-going support and feedback. Annette McElligott, Norah Power and all the staff in the CSIS Department for their support throughout my time in UL. Marie Casey for being Marie. Lorcan ONeill, Ger Moran, Aidan McDonagh and Eoin Mooney for the late nights and making me cups of tea. Gemma Browne for giving me encouragement when all hope seemed lost. Redmond OBrien for technical support. Colm Shannon and Adrian Shaughnessy (my fellow FYP Android Devs) for brainstorming and to all my fellow FYP students for sharing the stress and having the craic. And most importantly, my family for all their support over the years.

Abbreviations

GPS API HTC AOSP SDK ADT AVD NLP FYP UI SOAP

Global Positioning System Application Programming Interface High Tech Corporation Android Open Source Project Software Development Kit Android Development Tookit Android Virtual Device Network Location Provider Final Year Project User Interface Simple Object Access Protocol

Project Summary
My Final Year Project is a Smart Phone Application on the android platform that will; o Detect potholes on the roads while the user is driving o Report the location to Local Authorities for maintenance. When the user starts their journey, they launch the application on their phone and set it to record. The application launches the accelerometer and Network Location Provider (NLP) in the phone. The application monitors for changes in acceleration. When such a change is recorded, the application calls the NLP and asks for the coordinates of the pothole. The application then adds the time, the geographic coordinates and the severity of the pothole to the event log. When the user finishes their journey they press stop and are presented with the event log. They can then choose which events to report to the local authorities. When finished the user clicks report and the data is sent to a database. The benefit of this project is that it provides Local Authorities with the location and the severity of potholes, which they can repair and ultimately will result in safer and a more enjoyable driving experience.

Introduction
Project Background
Potholes are cracks and cavities on roads caused by freezing. Over long periods of time roads weaken under the weight of heavy vehicles. This causes small cracks to form. Water from rain or melted snow or ice gets into the cracks and freeze. This causes the cracks to expand. Continued pressure on the cracks lead to potholes. 1 As Ireland continues to suffer from worsening weather conditions each year 2, the issue of potholes remains an important issue. However Local Authorities are falling behind in repairing damage to the roads. According to the website Potholes.ie, there were 835 reported potholes in 2010 (up to the 20th of December) with only 149 logged as fixed.
3

Potholes.ie is one of several websites used by members of the public to support pothole reporting. However these websites require the user to remember exactly where the pothole was. Recent smart phone applications such as FixMyStreet encourage users to stop and take a photograph of the pothole (however this is not always an option). My project aims to create an Android Application that automatically records potholes and logs their exact location using GPS. This will hopefully significantly increase the numbers of potholes reported.

Overview
The application is based on the Androids built -in Accelerometer. An Accelerometer is a device that measures acceleration relative to free fall. Any significant changes in the phones acceleration are logged by the SeniorEventListener. The event is then added to an event log.
1

Minnesota, S o 2010. Potholes page [Online]. Available from : http://www.dot.state.mn.us/information/potholes/videoimages.html [Accessed : 20, December, 2010]. 2 Thomas Crosbie Media Ltd 2010. November cold snap enters record books | BreakingNews.ie [Online]. Available from : http://www.breakingnews.ie/ireland/eyidmhsnqlcw/ [Accessed : 20, December, 2010] 3 Administrator, 2010. Potholes.ie | County League Table [Online]. Available from : http://www.potholes.ie/county-league-table.html [Accessed : 20, December, 2010].

The Android platform also has tools for identifying the locationincluding a Global Positioning System (GPS) receiver (this is discussed further in the research section). One of the issues I have identified is the difficulty of getting an accurate location while travelling at average driving speeds. One possible solution is to record the journey from start to finish by regularly calling the location coordinates. This allows the application to plot the route and compare the events time stamp with the route to calculate the location of the car at the time of the event. When the journey finished, the user presses the stop recording button and is presented with the event log. This lists the events that have been recorded in this session (identification, time, location and severity). By clicking on the location the user can see the event displayed on a map (using the Google Maps API). Each event also has a tick box (ticked by default). If the box is not ticked the event will be excluded from the data to be transmitted to the database.

Motivation
This project was suggested by my Supervisor, Joe Griffin. For me this is a challenging project as I had no prior experience of Android development. I chose the Android platform because it is one of the fastest growing mobile operating systems on the market and is an open source development. This project allowed me to gain an understanding of how some of the built in frameworks can be utilised to develop application Furthermore this project demonstrates how mobile applications can contribute to improve road worthiness, road safety and a better driving experience in Ireland.

Objectives
The objectives of this project were to create an Application That can identify a change in acceleration unique to potholes (excludes speed bumps, cats eyes etc) That can obtain the most accurate location data possible That is able to transmit data to an external destination That has a good user interface- easy to use, clear instructions

My personal objective was to gain valuable experience in Android Development

Development Requirements
This project was developed on Eclipse using the Android Developer Toolkit. It was developed in Android API Level 7 (for users of Android 2.1 and later). This makes it available to 76% of Android users 4. I decided to use Eclipse because it the greatest level of online support. Android Applications are developed using the Java Framework 6. Testing completed on the Android Emulator and my phone a HTC Desire running Android 2.2 is the Google approved

development environment for Android Development 5 and as such has

Other Resources
Android Developer Website- http://developer.android.com/

Rubin, A 2010. Platform Versions | Android Developers [Online]. Available from : http://developer.android.com/resources/dashboard/platform-versions.html [Accessed : 23, November, 2010]. 5 Rubin, A 2010. ADT Plugin for Eclipse | Android Developers [Online]. Available from : http://developer.android.com/sdk/eclipse-adt.html [Accessed : 20, December, 2010]. 6 Rubin, A 2010. Application Fundamentals | Android Developers [Online]. Available from : http://developer.android.com/guide/topics/fundamentals.html [Accessed : 20, December, 2010].

Sams Teach Yourself Android Application Hoursby Lauren Darcey, Shane Conder

Development in 24

TutsPlus Android Tutorials - http://mobile.tutsplus.com/ StackOverflow.com, a online Q&A site for programmers.

Issues for consideration


One of the major difficulties would be differentiating between potholes and non-potholes. For example a bump on the road might also be recorded if a driver goes over speed bumps, cats eyes or other objects lying on the road. Another difficulty will be getting the exact location of the event whilst the car is moving at speed. Battery drainage is one of the key issues. The Accelerometer and GPS will drain the battery over time, especially during an extended journey. For such journeys a car charger is recommended.

Report Contents
I have based my chapter headings on the waterfall model Preparation Requirements Analysis Development

In the Requirements Analysis and Design chapter I will review the requirements and show the evolution into a working class diagram. The Development chapter will cover the various aspects of the development process and the challenges I came across while working on the product. I will also discuss how I tested the software. I will conclude with a review of my work complete and a discussion of future work to be undertaken.

10

Preparation
Android Development
Prior to beginning this progress I had no experience of Android Development. The first step was to figure out how Android Projects are structured. History Android is a mobile phone operating system. It was originally developed by Android Inc, which was acquired by Google in July 2005.7 Today, development is overseen by the Android Open Source Project (AOSP), led by Google. The AOSP is tasked with the maintenance and further development of Android.
8

As of the 3rd Quarter of 2010 Android has a market share of 25% making it the second most popular phone operating system of the market (second only to Nokias Symbian). This is a major rise from the 3.5% share Android had in 3Q2009.
9

Architecture Android is based on the Linux access Kernel. are all of Android able to the the Developers

componements

Application Framework used by core applications when creating an application.


Figure 1- Android Architecture (http://developer.android.com/images/system-architecture.jpg)

Elgin, B B 2010. [Online]. Available from : http://www.businessweek.com/technology/content/aug2005/tc20050817_0949_tc 024.htm [Accessed : 23, November, 2010]. 8 Rubin, A 2010. About the Android Open Source Project | Android Open Source [Online]. Available from : http://source.android.com/about/index.html [Accessed : 23, November, 2010]. 9 Gartner, I M 2010. Gartner Says Worldwide Mobile Phone Sales Grew 35 Percent in Third Quarter 2010; Smartphone Sales Increased 96 Percent [Online]. Available from : http://www.gartner.com/it/page.jsp?id=1466313 [Accessed : 23, November, 2010].
7

11

These

features

include

the

Location

Manager,

Bluetooth,

the

Accelerometer, and Email etc. 10 Application Framework An Android Application has four parts- Activities, Services, Broadcast Receivers and Content Providers. Activities are the visual interfaces for each task in the application. Activities in my Application might include the graph for displaying the Accelerometers data, the map displaying the route and the list of events logged. Each activity, despite being linked, is independent class. Services are the background tasks that dont have a user interface. Services might be linked to one or more activities. In this application Services would include recording the route over the duration of the journey (this happens even when the map is not displayed) The Broadcast Receiver receives and reacts to broadcast

announcements (for example, a low battery message). The Content Provider shares the applications data with other applications. This data can be stored in a SQLite database.

10

Rubin, A 2010. What is Android? | Android Developers [Online]. Available from : http://developer.android.com/guide/basics/what-is-android.html [Accessed : 20, December, 2010].

12

Existing applications
As part of my initial research I decided to investigate applications that offer the same or similar services for android and other platforms. My aim is to see how these applications work and to see how they can be improved. To date I have identified two Android Apps that offer the same service - Pothole agent and street bump. I also looked at photo driven applications and pothole reporting websites. Pothole agent Pothole agent is an application made by the BITS Android Team and is free to download from the android market. It works by recognising the acceleration over time (displayed on the graph). When you start the app you are presented with the graph and two event
Figure 2 Pothole Agent http://www.androidzoom.com/android_applications/tools /pothole-agent_isud.html

controllers (one which starts the accelerometer and one which starts the session). I would not recommend this as there was no explanation of what each button did or how to use the application. The user interface was poor and offers little instruction to the user. I was able to figure out most of the functionally by trial and error but I do not believe the average user would have the patience or technical knowledge to be able to do so. One of the flaws identified was that the GPS is not automatically turned on when launching the app. The user needs to go to the phones settings to turn it on. It is possible for applications to change the GPS setting on launching.

13

Street bump Street bump is relatively new application based upon the same concept. Like the user interface it is confusing. Instead of a graph the X, Y and Z fields are represented by circles with the size and colour changing depending on acceleration. However there is no explanation as to the meaning of the different colours. One positive feature is that there is a simple option called Start Recording. It also automatically starts the GPS function. This app has received criticism due for being battery heavy, so much so that users are advised to use car chargers while the app is in use. Overall impressions Neither of the applications I investigated were satisfactory from the perspective of the end user, Applications should be user friendly and easy to figure out. I intend to create an application that addresses these issues. Photo driven applications There are several applications (some developed by local authorities) that offer pothole reporting systems that require the user to take a photograph and upload it with the location data as opposed to a detection system. These can be used for a
Figure 3 Fix My Street www.androidzoom.com/android_applications/pro ductivity/fixmystreet_xpp.html

number of reports (potholes, graffiti, broken lights etc) Examples of these applications are Fix my Street (android), See Click Fix (iPhone) and Fill my Hole (iPhone). I tried to test Fix My Street but the reporting feature only works in the UK.

14

Users can take photographs and add a description and their contact details. In my opinion the user interface on Fix My Street is very simple to use. Websites In addition to phone applications, there are several websites that allow users to report potholes. Potholes.ie was founded by David Well (founder of www.ripoff.ie) following the big freeze of winter 2009/2010 11. Registered users can submit details of potholes (location and description). The website contains a map where you can see potholes (marked as reported pothole, reported uneven surface and Reported Fixed Issues) and a league table of both reported and fixed potholes by county. There are also details for contacting your council and making a claim. Other similar websites include: Pothole Watch (http://www.potholewatch.com) Watch That Hole (http://www.watchthathole.com).

Similar Research Projects I have discovered two similar projects on going in third level institutes. One of these is in Trinity College,Dublin and the other in Massachusetts Institute of Technology. . While I did not have the time to explore these fully, it is interesting to note that similar work is underway.

Development Requirements
I downloaded the following software on to both my laptop and my assigned PC in the Computer Science & Information Systems (CSIS) building:
11

O Ftharta, C. (2010) 23% of cars damaged by potholes , The Irish Examiner, 10 May, Available from : http://www.examiner.ie/ireland/23-of-cars-damaged-by-potholes-119526.html [Accessed : 20, December, 2010].

15

Eclipse Android Software Development Kit (SDK) Eclipse Android Developer Toolkit (ADT)

It took a considerable amount of time to get the software to work in CSIS building. This is due to the firewall on the CSIS network which redirected some of the downloaded files to a different folder. I was able to solve this problem with the help of Redmond OBrien (CSIS Department), Colm Shannon and Adrian Shaughnessy (my fellow students). As I was working off two machines I stored most of my files on a Dropbox folder which allowed me to access it from different machines. This prevented me from having multiple versions of the software.

16

Requirements Analysis
Identifying User Requirements
At the beginning of the project, I contacted the roads department of each Local Authority in the Mid-West Region. Only one of these departments, Limerick City Council, replied to me. They were not interested in contributing to the project as they felt it would not benefit their work. I recently got in contact with the management of Potholes.ie who gave me some very valuable feedback for the project. I hope to follow up with this in the future.

Use Case Diagram

17

Flowchart
After the Use Case diagram I put together a Flowchart diagram which outlined the iterative steps the application goes through while active.

18

Class Diagram
I made an initial Class Diagram which shows the various components of the program

Screen Mock ups


I also developed a series of screen mock ups based on what I intended the User Interface (UI) to look like.

19

Development
For the development phase I divided the work up into 4 parts: Accelerometer Map User Interface/Splash Event log/database

Each part was treated as a separate unit and later merged to form the overall application.

Accelerometer
The major element of this project is the Accelerometer. An accelerometer is an electromechanical device that measures acceleration. 12 An accelerometer is one of the many hardware features contained in some android phones and has been used to create several interesting Android Applications. Examples of these include: G-Lock:- locks/unlocks the key pad based on movement of the phone Newtons Cradle13 Raging Thunder:- a car racing game. Cradle:demonstrates the physics of Newtons

The accelerometer is one of several sensors available through the android API.

Engineering, D 2010. A beginner's guide to accelerometers [Online]. Available from : http://www.dimensionengineering.com/accelerometers.htm [Accessed : 18, December, 2010]. 13 accelerometer Android Freeware. Download free accelerometer apps for Android Phones. [Online]. Available from : http://www.androidfreeware.net/tag-accelerometer.html [Accessed : 20, December, 2010].
12

20

How it works The Accelerometer measures acceleration on three axes- Azmuth (X), Pitch (Y) and Role (Z). The X axis is horizontal and points to the right, the Y axis is vertical and points up and the Z axis points towards the outside of the front.
14

Any sudden significant changes to one of the Axes should indicate that the car has hit a bump while driving15. The Android API has three classes: SensorManager SensorEvent SensorEventListener

Figure 4- XYZ axes (http://developer.android.com/image s/axis_device.png)

SensorManager checks if the device has one or more sensors. The HTC Desire uses BMA150 3-Axis sensor to measure Acceleration and the AK8973 sensor to measure magnetic force. If no sensor is picked up, it returns a null value. SensorEventListenter checks for changes to sensor data while SensorEvent stores the data.

14

Rubin, A 2010. SensorEvent | Android Developers [Online]. Available from : http://developer.android.com/reference/android/hardware/SensorEvent.html [Accessed : 20, December, 2010] 15 Raging Thunder Android Game Review by AndroidTapp.com | Android Tapp. Android App Reviews [Online]. Available from : http://www.androidtapp.com/raging-thunder/ [Accessed : 20, December, 2010].

21

Identifying potholes One of the biggest questions I had to answer was how to identify

potholes. Was there a definite way to differentiate whether the car went over a pothole, a speed bump, cattle grid, rock or any other item on the road? Does the speed of the car, the size of the pothole or the position of the phone affect the readings? From my research, all these factors need to taken into account. At the moment the application records when the device drops below 25 on the Z axis as this should indicates that the car has dropped. This however is not accurate enough for the requirements of the application. The threshold should be set high enough to ignore minor anomalies on the roads such as road markings, rocks and cats eyes. A speed threshold may also need to be set to prevent sudden braking from setting off a sensor event. A similar project (Eriksson, Girod et al, 2008) suggests that Z axis should be compared to the X axis. If a car did hit a pothole the X axis should change as one side of the car hits the pothole. This research also suggests that the threshold is reached more regularly when the car travels at higher speeds. Therefore I would suggest that the threshold increases with the speed. Displaying the information Of the applications I have investigated, there are three ways to display the data. Pothole agent uses a graph displaying the X, Y and Z axes while Street Bump displays the data as circles that expand as acceleration increases. Other sensor apps simply display the X, Y and Z as text. While I used the text format, I found the graph method to be preferable as it is easier for the end user to understand what is happening. 22

Other issues I found the accelerometer difficult to work and the area I struggled with the most. The Android Virtual Device (AVD) is unable to run sensor apps because it cannot generate the data. A recent workaround called SensorSimulator (http://code.google.com/p/openintents/wiki/SensorSimulator) has fixed this problem. As sensor based apps could not be tested using the AVD, resources on how to programme for it were limited.

23

Location
The second part of the project was to record the location of the event. One of the better known features of android phones is the Network Location Manager which can record the devices location using either GPS and then display it using Google Maps The users location is used in many applications inc luding Satellite Navigation (Google Maps Navigation), Location based Social Networking (e.g. Foursquare) and Augmented Reality browser (e.g. Layer and Wikitude).

How it works
When the application is started the app calls Androids location listener which takes data from the phones inbuilt Global Positioning System (GPS) or from Cell tower or WiFi data. The GPS (fine location) is the most accurate. GPS uses a network of 27 Earth Orbiting Satellites (24 active and 3 backups) developed by the US Military. The orbits are arranged so that at anytime, anywhere on Earth, there are at least four satellites "visible" in the sky. The GPS receiver between locates four itself and or each more of these and
Figure 5 GPS Satellites in orbit http://www8.garmin.com/graphics/24s atellite.jpg

satellites. It then calculates the distance satellite compares the distances to triangulate its own location 16. However despite the accuracy, GPS has some limitations. It only works outdoors, has a high battery consumption rate and is slower to return the location.

16

HowStuffWorks, I D 2010. HowStuffWorks "How GPS Receivers Work" [Online]. Available from : http://electronics.howstuffworks.com/gadgets/travel/gps.htm [Accessed : 18, December, 2010]

24

The alternatives to GPS use Cell tower and WiFi Signals to determine location. While they are not as accurate, they work indoors and outdoors, respond faster and require less battery power. This is known as the course location Challenges Another key challenge is identifying user location in a moving vehicle, especially considering GPS slow return rate. The easiest solution is to call the last known location. However the accuracy of this is questionable. One possible solution is to record the entire journey from start to finish. This involves calling the location at regular intervals to determine the route. When an event is recorded, the Application compares the events timestamp to the route to get the location of the event. Displaying the information For ease of programming the application currently displays the data in a digital decimal number for both Latitude and Longitude. The route and location of the Events can be displayed on a map using the Google Maps API which is available to android developers. In order to display data from Google Maps you need to register for a Maps API Key. Later versions The set up for the Network Location Provider for Android 2.2 and earlier is awkward as you have to set up the listeners to record all changes. In Gingerbread (Android 2.3), you can simply call a one-time location request using the requestSingleUpdate() method 17. This would have considerably helped my project.

17

Kanderi, P 2011. Building Location-Based Apps in Android - Part 1, AnDevCon 2011 [Online]. Available from:

25

User Interface/Splash
A critical aspect of this project was examining how the app would look and its usability. The layout of android applications is defined in a XML file (in this case main.xml, main2.xml and splash.xml) When the App is launched, it displays a Splash Screen- an activity that contains a logo- for a number of sections before proceeding to mainmenu.java. The layout for the splash is defined in splash.xml. I had begun testing a tabbed design and a Google maps overlay for location. When complete this should offer a high level of usability.

Event log/database
Once the SensorEvent is created, it needs to be stored somewhere. The Android API supports development of a SQLite database. SQLite is a software library that implements a self-contained, serverless, zeroconfiguration, transactional SQL database engine 18. Data is stored in the database. The initial design included a list view that read the entries in the database and displayed them using the ListView format. Users could remove events from the list which would delete them from the table. On clicking the submit button the application would transmit the SQL data to an external server using the Simple Object Access Protocol (SOAP). The database would then be cleared.

http://www.andevcon.com/Spring2011PDFS/Presentations/702.pdf [Accessed 14 April 2011].

18

SQLite Home Page. 2011. SQLite Home Page. [ONLINE] Available at:

http://www.sqlite.com. [Accessed 14 April 2011].

26

Testing
During development I tested the application on an Android device while driving. The aim was to observe the sensors in action and while these tests were not scientific in nature, they allowed me to get a better understand of how the sensors react to movement while travelling in a car. Further testing will be required prior to the Application being launched.

Overall Development
I originally developed several individual apps and concentrated on getting each individual part working before combining them. The different sub-applications were: o Splash the screen that loads when the app is launched o The Accelerometer o Location o List o Database During development I was regularly faced run time errors, which caused the app to require a force close. I found this particularly frustrating as there was no indication which part of the code was causing the problem. For each of these problems I carefully reviewed the code for problems and tried alternative methods to reduce errors. As soon as I had the individual applications working I began the process of merging the apps together. I started by merging the Splash (splashscreen.java) and Accelerometer app (in mainmenu.java). I was successful in this attempt. I set up the mainmenu activity to launch location.java (which displays the latitude and longitude in digital decimal format) using an intent. 27

This worked until I tried to return to mainmenu after a certain length of time. I have made several attempts to fix this bug prior to submission but have yet to find a solution. I had also been working on setting up a SQLite Database (in database.java) to store the data and a tabbed view to allow the user to switch between the sensor data and the location. While this has not been completed at the time of the report, I plan to develop these further. At the time of submission my application was capable of doing the following: Displaying a welcoming screen Reading and displaying the Sensor data Registering when the sensor data passed a threshold Reading and displaying location data

28

Conclusions
I found this project to be far more difficult than I ever anticipated. Without doubt, this has been the most challenging and at the same time rewarding programming project I have undertaken since I started college. Unfortunately while I failed to complete all the projects requirements in time for submission, I have developed the groundwork for an application with great potential. The reasons for the failure to complete were mainly due to the complexity of the project and my personal time management.

Review of objectives
Objective 1: That can identify a change in acceleration unique to potholes Currently the application can read data from the sensors and recognise a jolt. Work has been started on refining the algorithm for detecting potholes as opposed to other road anomalies. Objective2: That can obtain the most accurate location data possible The application can read location data from both GPS and Cell tower/WiFi data. Objective 3: That is able to transmit data to an external destination This work is on- going. Objective 4: That has a good user interface- easy to use, clear instructions While the app is incomplete, it has a simple user interface.

29

Project Schedule
Before beginning the project, I set out a project plan using the Gant Chart method.

At times when I was struggling with the project, the schedule was useful for identifying where I should be. During each week I set aside three blocks of two hours in my timetable for FYP work. Towards the end I set aside an additional hour per week for the report.

Communication with Supervisor


Unfortunately, communication with my supervisor was limited. On reflection I could have been more proactive in this area and I will keep this in mind in future work.

Scope for future work


I intend to keep working on this application beyond the FYP and I have set a personal target of 31st August 2011 to have a working application available on the Android Market. My plan is Fix all existing bugs Finish the implementation of the SQLite database. Develop a messaging system for sending data from the phone to the server 30

Introduce a tabbed design, a Google Maps display and a form for deciding what events to report.

Long term I would like to make a version of this application for other platforms. This would involve learning objective C for the iPhone/iOs and XNA and/or Silverlight for the Windows Phone platform. Overall I would like to continue developing for Android as despite the challenges and difficulties I have faced, I have enjoyed Android Development.

31

Bibliography
Accelerometer Android Freeware, Download free accelerometer apps for Android Phones. [Online]. Available from: http://www.androidfreeware.net/tag-accelerometer.html [Accessed : 20, December, 2010]. Ajisafe, T 2010. Investigating the Use of Smart Phones as Sensors for Road Condition Monitoring. [ONLINE] Available at: http://www.scss.tcd.ie/postgraduate/mscmuc/prospective/industry_ day/2010/Temitope%20Ajisafe.pdf [Accessed 14 April 2011]. Darcey, L & Conder, S 2010, Sams Teach Yourself Android Application Development in 24 Hours (Sams Teach Yourself -- Hours). Elgin, B B 2010. [Online]. Available from: http://www.businessweek.com/technology/content/aug2005/tc2005 0817_0949_tc024.htm [Accessed : 23, November, 2010]. Engineering, D 2010. A beginner's guide to accelerometers [Online]. Available from : http://www.dimensionengineering.com/accelerometers.htm [Accessed : 18, December, 2010]. Eriksson, J., Girod, L., Hull, B., Newton, R., Madden, S. and Balakrishnan, H. - ''ACM ~MobiSys 2008'' Gartner, I M (2010), Gartner Says Worldwide Mobile Phone Sales Grew 35 Percent in Third Quarter 2010; Smartphone Sales Increased 96 Percent [Online]. Available from : http://www.gartner.com/it/page.jsp?id=1466313 [Accessed : 23, November, 2010]. McLoughlin, M 2010. Android Development (presentation) [Online]. Available from: http://www.idc.ul.ie/anu/MiLKlabs/AndroidDevelopment.pdf [Accessed : 21, December, 2010]. Minnesota, S o 2010. Potholes page [Online]. Available from : http://www.dot.state.mn.us/information/potholes/videoimages.html [Accessed : 20, December, 2010]. O Ftharta, C. (2010) 23% of cars damaged by potholes , The Irish Examiner, 10 May, Available from : http://www.examiner.ie/ireland/23-of-cars-damaged-by-potholes119526.html [Accessed : 20, December, 2010]. Potholes.ie [Online]. Available from : http://www.potholes.ie [Accessed : 20, December, 2010]. 4

Raging Thunder Android Game Review by AndroidTapp.com | Android Tapp. Android App Reviews [Online]. Available from : http://www.androidtapp.com/raging-thunder/ [Accessed : 20, December, 2010]. Rubin, A 2010. About the Android Open Source Project | Android Open Source [Online]. Available from: http://source.android.com/about/index.html [Accessed : 23, November, 2010]. Kanderi, P 2011. Building Location-Based Apps in Android - Part 1, AnDevCon 2011 [Online]. Available from: http://www.andevcon.com/Spring2011PDFS/Presentations/702.pdf [Accessed 14 April 2011]. SQLite Home Page. 2011. SQLite Home Page. [ONLINE] Available at: http://www.sqlite.com. [Accessed 14 April 2011]. The Pothole Patrol: Using a Mobile Sensor Network for Road Surface Monitoring| http://db.csail.mit.edu/pubs/mobisys08.pdf ]] Thomas Crosbie Media Ltd 2010. November cold snap enters record books | BreakingNews.ie [Online]. Available from: http://www.breakingnews.ie/ireland/eyidmhsnqlcw/ [Accessed : 20, December, 2010]

Appendences
Code
MainMenu.Java package com.csis.fyp import android.app.Activity; import android.content.Intent; import android.hardware.SensorListener; import android.hardware.SensorManager; import android.os.Bundle; import android.util.Log; import android.widget.TextView; @SuppressWarnings("deprecation") public class mainmenu extends Activity implements SensorListener { private static final String TAG = "SensorDemo"; private SensorManager sensorManager; private TextView outView; private int sensor = SensorManager.SENSOR_ORIENTATION; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); outView = (TextView) findViewById(R.id.output); // Read sensor manager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); } /** Register for the updates when Activity is in foreground */ @Override protected void onResume() { super.onResume(); Log.d(TAG, "onResume"); sensorManager.registerListener(this, sensor); } /** Stop the updates when Activity is paused */ @Override //what happens when the sensors are paused protected void onPause() { super.onPause(); Log.d(TAG, "onPause"); sensorManager.unregisterListener(this, sensor); } 6

public void onAccuracyChanged(int sensor, int accuracy) { Log.d(TAG, String.format("onAccuracyChanged sensor: %d accuraccy: %d", sensor, accuracy)); } public void onSensorChanged(int sensorReporting, float[] values) { if (sensorReporting != sensor) return; //define variables float azimuth = Math.round(values[0]); float pitch = Math.round(values[1]); float roll = Math.round(values[2]); //output sensor data String out = String.format("X: %.2f\nY:%.2f\nZ %.2f", azimuth, pitch, roll); Log.d(TAG, out); outView.setText(out); //define threshold if (roll < - 25) { //display text on threshold being passed String out1 = String.format("POTHOLE!!!!"); Log.d(TAG, out1); outView.setText(out1); //intent switches to location.java to read current location Intent myIntent = new Intent(outView.getContext(), location.class); startActivityForResult(myIntent, 0); } }

} SplashScreen.Java package com.csis.fyp import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class SplashScreen extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); Thread splashThread = new Thread() { 7

@Override public void run() { //sets time delay for changing to main menu try { int waited = 0; while (waited < 5000) { sleep(100); waited += 100; } } catch (InterruptedException e) { // do nothing } finally { finish(); Intent i = new Intent(); i.setClassName("com.testing.splashscreensample", "com.testing.splashscreensample.mainmenu"); startActivity(i); } } }; splashThread.start(); } } Location.Java package com.csis.fyp import android.app.Activity; import android.content.Context; import android.content.Intent; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class location extends Activity implements LocationListener { private static final View outView = null; private TextView latituteField; private TextView longitudeField; private LocationManager locationManager; private String provider; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); 8

latituteField = (TextView) findViewById(R.id.TextView02); longitudeField = (TextView) findViewById(R.id.TextView04); // Get the location manager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // Define the criteria how to select the location provider -> use // default Criteria criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(provider); // Initialize the location fields if (location != null) { System.out.println("Provider " + provider + " has been selected."); double lat = (double) (location.getLatitude()); double lng = (double) (location.getLongitude()); latituteField.setText(String.valueOf(lat)); longitudeField.setText(String.valueOf(lng)); } else { latituteField.setText("Provider not available"); longitudeField.setText("Provider not available"); } } /* Request updates at startup */ @Override protected void onResume() { super.onResume(); locationManager.requestLocationUpdates(provider, 400, 1, this); } /* Remove the locationlistener updates when Activity is paused */ @Override protected void onPause() { super.onPause(); locationManager.removeUpdates(this); } // @Override public void onLocationChanged(Location location) { //gets the lat and long varriables and stores as doubles double lat = (double) (location.getLatitude()); double lng = (double) (location.getLongitude()); //defines output (lat and long) latituteField.setText(String.valueOf(lat)); longitudeField.setText(String.valueOf(lng)); 9

//this is supposed to return to mainmenu.java Intent myIntent = new Intent(outView.getContext(), mainmenu.class); startActivityForResult(myIntent, 0);

} @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { Toast.makeText(this, "Enabled new provider " + provider, Toast.LENGTH_SHORT).show(); } @Override public void onProviderDisabled(String provider) { Toast.makeText(this, "Disenabled provider " + provider, Toast.LENGTH_SHORT).show(); } } Database.java package com.csis.fyp import android.app.Activity; import android.content.Context; import android.content.Intent; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class location extends Activity implements LocationListener { private static final View outView = null; private TextView latituteField; private TextView longitudeField; private LocationManager locationManager; private String provider;

10

/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); latituteField = (TextView) findViewById(R.id.TextView02); longitudeField = (TextView) findViewById(R.id.TextView04); // Get the location manager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // Define the criteria how to select the location provider -> use // default Criteria criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(provider); // Initialize the location fields if (location != null) { System.out.println("Provider " + provider + " has been selected."); double lat = (double) (location.getLatitude()); double lng = (double) (location.getLongitude()); latituteField.setText(String.valueOf(lat)); longitudeField.setText(String.valueOf(lng)); } else { latituteField.setText("Provider not available"); longitudeField.setText("Provider not available"); } } /* Request updates at startup */ @Override protected void onResume() { super.onResume(); locationManager.requestLocationUpdates(provider, 400, 1, this); } /* Remove the locationlistener updates when Activity is paused */ @Override protected void onPause() { super.onPause(); locationManager.removeUpdates(this); } // @Override public void onLocationChanged(Location location) { //gets the lat and long varriables and stores as doubles 11

double lat = (double) (location.getLatitude()); double lng = (double) (location.getLongitude()); //defines output (lat and long) latituteField.setText(String.valueOf(lat)); longitudeField.setText(String.valueOf(lng)); //this is supposed to return to mainmenu.java Intent myIntent = new Intent(outView.getContext(), mainmenu.class); startActivityForResult(myIntent, 0);

} @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { Toast.makeText(this, "Enabled new provider " + provider, Toast.LENGTH_SHORT).show(); } @Override public void onProviderDisabled(String provider) { Toast.makeText(this, "Disenabled provider " + provider, Toast.LENGTH_SHORT).show(); } } Main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">

<TextView android:text="@string/hello" android:id="@+id/output" android:textSize="24sp" android:layout_margin="30dp" android:layout_width="fill_parent" android:layout_height="fill_parent"> 12

</TextView> </LinearLayout> Main2.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="horizontal" android:layout_marginTop="40dip"> <TextView android:text="Latitude: " android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/TextView01" android:layout_marginLeft="10dip" android:layout_marginRight="5dip" android:textSize="20dip"></TextView> <TextView android:text="unknown" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/TextView02" android:textSize="20dip"></TextView> /> </LinearLayout>

<LinearLayout android:id="@+id/linearLayout2" android:layout_height="wrap_content" android:layout_width="wrap_content"> <TextView android:text="Longitute: " android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/TextView03" android:layout_marginLeft="10dip" android:layout_marginRight="5dip" android:textSize="20dip"></TextView> <TextView android:text="unknown" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/TextView04" android:textSize="20dip"></TextView> </LinearLayout>

</LinearLayout> Splash.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 13

android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:src="@drawable/splash" android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content"> </ImageView> </LinearLayout>

Strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">Welcome to Pothole Mapper, an automatic pothole detection app</string> <string name="app_name">Pothole Mapper</string>

</resources>

AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.testing.splashscreensample" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".SplashScreen" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

<activity android:name="mainmenu"></activity> <activity android:name="location"></activity> </application> <uses-sdk android:minSdkVersion="7" /> </manifest>

14

Potrebbero piacerti anche