diff --git a/phoneClients/android/.idea/libraries/android_async_http_1_4_4.xml b/phoneClients/android/.idea/libraries/android_async_http_1_4_4.xml
new file mode 100644
index 0000000..57498e3
--- /dev/null
+++ b/phoneClients/android/.idea/libraries/android_async_http_1_4_4.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/phoneClients/android/.idea/workspace.xml b/phoneClients/android/.idea/workspace.xml
index 4d23565..9f79247 100644
--- a/phoneClients/android/.idea/workspace.xml
+++ b/phoneClients/android/.idea/workspace.xml
@@ -1,5 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
@@ -81,6 +99,7 @@
+
@@ -90,19 +109,19 @@
-
+
-
+
-
-
+
+
-
+
@@ -111,19 +130,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -526,15 +533,17 @@
-
-
+
+
+
+
-
-
+
+
@@ -561,7 +570,7 @@
-
+
@@ -580,8 +589,6 @@
-
-
@@ -614,8 +621,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -625,15 +686,18 @@
-
+
-
+
+
+
+
@@ -816,8 +880,8 @@
-
-
+
+
@@ -830,24 +894,54 @@
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/phoneClients/android/GpsTracker/GpsTracker.iml b/phoneClients/android/GpsTracker/GpsTracker.iml
index e872ed4..9281d30 100644
--- a/phoneClients/android/GpsTracker/GpsTracker.iml
+++ b/phoneClients/android/GpsTracker/GpsTracker.iml
@@ -70,6 +70,7 @@
+
diff --git a/phoneClients/android/GpsTracker/build.gradle b/phoneClients/android/GpsTracker/build.gradle
index 4941819..06a694c 100644
--- a/phoneClients/android/GpsTracker/build.gradle
+++ b/phoneClients/android/GpsTracker/build.gradle
@@ -12,9 +12,14 @@
mavenCentral()
}
+dependencies {
+ // check here and change the version (1.4.4) below if necessary. http://loopj.com/android-async-http/
+ compile group: 'com.loopj.android', name: 'android-async-http', version: '1.4.4'
+}
+
android {
compileSdkVersion 19
- buildToolsVersion "19.0.0"
+ buildToolsVersion '19.0.0'
defaultConfig {
minSdkVersion 10
@@ -24,6 +29,7 @@
dependencies {
compile 'com.android.support:appcompat-v7:+'
+ // check here and change the version (4.0.30) below if necessary. http://developer.android.com/google/play-services/setup.html
compile 'com.google.android.gms:play-services:4.0.30'
}
diff --git a/phoneClients/android/GpsTracker/src/main/AndroidManifest.xml b/phoneClients/android/GpsTracker/src/main/AndroidManifest.xml
index d1da699..f75ccf1 100644
--- a/phoneClients/android/GpsTracker/src/main/AndroidManifest.xml
+++ b/phoneClients/android/GpsTracker/src/main/AndroidManifest.xml
@@ -10,6 +10,7 @@
+
0) {
+ requestParams.put("distance", totalDistanceInMeters / 1609); // in miles
+ } else {
+ requestParams.put("distance", 0); // in miles
+ }
+
+ requestParams.put("phonenumber", "momo25");
+ requestParams.put("sessionid", sessionID); // uuid
+ requestParams.put("accuracy", location.getAccuracy()); // in meters
+ requestParams.put("locationisvalid", "yes");
+ requestParams.put("extrainfo", location.getAltitude());
+ requestParams.put("eventtype", "android");
+
+ MyHttpClient.post(null, requestParams, new AsyncHttpResponseHandler() {
+ @Override
+ public void onSuccess(int statusCode, org.apache.http.Header[] headers, byte[] responseBody) {
+ Log.e(TAG, "onSuccess statusCode: " + statusCode);
+ }
+ @Override
+ public void onFailure(int statusCode, org.apache.http.Header[] headers, byte[] errorResponse, Throwable e) {
+ Log.e(TAG, "onFailure statusCode: " + statusCode + " errorResponse: " + errorResponse);
+ }
+ });
+ }
+
+ protected void displayLocationData(Location location) {
+ DateFormat dateFormat = new SimpleDateFormat("hh:mm:ss");
+ dateFormat.setTimeZone(TimeZone.getDefault());
+ Date date = new Date(location.getTime());
+
longitudeTextView.setText("longitude: " + location.getLongitude());
latitudeTextView.setText("latitude: " + location.getLatitude());
accuracyTextView.setText("accuracy: " + location.getAccuracy());
providerTextView.setText("provider: " + location.getProvider());
timeStampTextView.setText("timeStamp: " + dateFormat.format(date));
+
+ Log.e(TAG, dateFormat.format(date) + " accuracy: " + location.getAccuracy());
}
public void stopTracking(View v) {
@@ -191,5 +262,4 @@
return rootView;
}
}
-
}
diff --git a/phoneClients/android/GpsTracker/src/main/java/com/websmithing/gpstracker/MyHttpClient.java b/phoneClients/android/GpsTracker/src/main/java/com/websmithing/gpstracker/MyHttpClient.java
new file mode 100644
index 0000000..46ac957
--- /dev/null
+++ b/phoneClients/android/GpsTracker/src/main/java/com/websmithing/gpstracker/MyHttpClient.java
@@ -0,0 +1,14 @@
+package com.websmithing.gpstracker;
+
+import com.loopj.android.http.AsyncHttpClient;
+import com.loopj.android.http.AsyncHttpResponseHandler;
+import com.loopj.android.http.RequestParams;
+
+public class MyHttpClient {
+ private static final String defaultUploadWebsite = "http://www.websmithing.com/gpstracker2/getgooglemap3.php";
+ private static AsyncHttpClient client = new AsyncHttpClient();
+
+ public static void post(String url, RequestParams requestParams, AsyncHttpResponseHandler responseHandler) {
+ client.post(defaultUploadWebsite, requestParams, responseHandler);
+ }
+}