Java Code
PHP Scripts as .txt files
Presentation
ReadMe.TXT
Hello and welcome to the ReadMe of Congestion, the senior capstone assigned to Noah Doperalski
In order for this app to work correctly, a few things need to be enabled on your phone.
1. Location
2. Internet/Data
In order to turn location on for the app, you need to go to app permissions in settings and allow
Congestion to access your location otherwise the app will immediately crash when launching the
Pinger activity.
======== THE APP ========
Once the app launches with the permissions allowed, the home screen will appear.
//// Pinger Activity \\\\
If you want to collect data, press the GPS Pinger button. This will take you to the GPS Pinger
activity. In order to start collecting data, we need to press the start button. This will allow
GPS pinging and start to get data every 10 seconds.
!!!!!!! NOTE !!!!!!!!!
THIS APP DOES NOT TRACK PEOPLE! ONLY GPS DATA
The pinger activity will run as long as you have the screen open and the Pinger activity active.
If you minimize the app or turn the screen off, a service will launch and continue to gather data
even while the phone is in sleep or standby mode.
The service will destroy itself when the activity is resumed. This can either be from turning the
screen directly onto the activity or maximizing the app from the task manager.
\\\\ Pinger Activity ////
----------------------------
//// Map View Activity \\\\
This activity will launch when the MapView button is pressed on the home screen. This activity is a
little more complicated since it has a WebView object which will hold the returned map from the
backend PHP.
The MapView will load and be blank at first. The map itself is hidden on the webpage since currently
there is no data being requested from the user. If you scroll down, you can click the button 'Get Data'
to return ALL data gathered by the app.
Further down the page, there are two drop down lists and a calender to select days and specific time to
constrain the data down. Once you click submit, an HTTP request will go out to gather the data based
on the constraint data sent to the server.
To get the new map, click the 'Get Data' button about half-way down the next page. The new map will output
showing you points where there are high areas of foot traffic on campus at the constrained times.
In order to return to the first activity on phone, you MUST press the back button on the phone. This will
take you back to the MapView activity initially since that was where we initially came from. To go all the
way back to the home screen, you have to press back once more.
\\\\ Map View Activity ////
----------------------------
//// PHP \\\\
The backend PHP for this project consists of some test files and some actual files.
The test files constitute of:
read_one.php
read_elements.php
The actual files that perform actions in the project are:
getMethod.php
index.php
insert.php
!!!! NOTE !!!!
In order to view the PHP code, you must edit it in a text editor otherwise the script will just run.
To navigate around the webpage when launching from a PC or Laptop, you only need to worry about the PHP end.
Since there is no Java here, Javascript takes over for displaying the Google Maps.
In order to navigate between the two PHP scripts that are executing, you only need to press the back arrow in
your browser to navigate to the previous screen.
The SQL database running in the background will hold all the data to pull from. The data is formatted in a
specific way as to keep consistency throughout the PHP scripts.
\\\\ PHP ////
--------------------------
//// SQL \\\\
The database consists of one table with a primary key and 3 other attributes:
PRIMARY_KEY = int id
double Latitude = holds latitude
double Longitude = holds longitude
datetime timeOfPing = dd/mm/yyyy 24 hour format (ie 3:00PM = 15:00:00)
When queried, the database looks for entries matching the given time. Time is NOT the PRIMARY_KEY since
the app pings and stores the users location 4 times as to make data collection easier
\\\\ SQL ////