diff --git a/phoneClients/android/.idea/libraries/android_async_http_1_4_6.xml b/phoneClients/android/.idea/libraries/android_async_http_1_4_6.xml deleted file mode 100644 index 775371d..0000000 --- a/phoneClients/android/.idea/libraries/android_async_http_1_4_6.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/android_async_http_1_4_9.xml b/phoneClients/android/.idea/libraries/android_async_http_1_4_9.xml new file mode 100644 index 0000000..ccea99d --- /dev/null +++ b/phoneClients/android/.idea/libraries/android_async_http_1_4_9.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/appcompat_v7_20_0_0.xml b/phoneClients/android/.idea/libraries/appcompat_v7_20_0_0.xml deleted file mode 100644 index ff9c6c1..0000000 --- a/phoneClients/android/.idea/libraries/appcompat_v7_20_0_0.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/appcompat_v7_21_0_3.xml b/phoneClients/android/.idea/libraries/appcompat_v7_21_0_3.xml new file mode 100644 index 0000000..751a9d9 --- /dev/null +++ b/phoneClients/android/.idea/libraries/appcompat_v7_21_0_3.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/httpclient_4_3_6.xml b/phoneClients/android/.idea/libraries/httpclient_4_3_6.xml new file mode 100644 index 0000000..a479d14 --- /dev/null +++ b/phoneClients/android/.idea/libraries/httpclient_4_3_6.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/play_services_4_3_23.xml b/phoneClients/android/.idea/libraries/play_services_4_3_23.xml deleted file mode 100644 index 0f3af43..0000000 --- a/phoneClients/android/.idea/libraries/play_services_4_3_23.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/play_services_6_5_87.xml b/phoneClients/android/.idea/libraries/play_services_6_5_87.xml new file mode 100644 index 0000000..5007d58 --- /dev/null +++ b/phoneClients/android/.idea/libraries/play_services_6_5_87.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/support_annotations_20_0_0.xml b/phoneClients/android/.idea/libraries/support_annotations_20_0_0.xml deleted file mode 100644 index 7eacba5..0000000 --- a/phoneClients/android/.idea/libraries/support_annotations_20_0_0.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/support_annotations_21_0_3.xml b/phoneClients/android/.idea/libraries/support_annotations_21_0_3.xml new file mode 100644 index 0000000..6fbaa90 --- /dev/null +++ b/phoneClients/android/.idea/libraries/support_annotations_21_0_3.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/support_v4_20_0_0.xml b/phoneClients/android/.idea/libraries/support_v4_20_0_0.xml deleted file mode 100644 index 0db4e14..0000000 --- a/phoneClients/android/.idea/libraries/support_v4_20_0_0.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/support_v4_21_0_3.xml b/phoneClients/android/.idea/libraries/support_v4_21_0_3.xml new file mode 100644 index 0000000..447a9ed --- /dev/null +++ b/phoneClients/android/.idea/libraries/support_v4_21_0_3.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/workspace.xml b/phoneClients/android/.idea/workspace.xml index 206953d..263bb2e 100644 --- a/phoneClients/android/.idea/workspace.xml +++ b/phoneClients/android/.idea/workspace.xml @@ -41,7 +41,22 @@ - + + + + + + + + + + + + + + + + @@ -95,8 +110,8 @@ @@ -107,29 +122,23 @@ - + - + + + - - + + - - - - - - - - - - - - - + + + + + @@ -493,19 +502,19 @@ + @@ -1018,6 +1030,7 @@ + @@ -1220,7 +1233,6 @@ - @@ -1244,6 +1256,8 @@ + + @@ -1459,37 +1473,37 @@ - + + + - + + - + + - - - - @@ -1497,15 +1511,15 @@ - - - + + + - + @@ -1518,8 +1532,8 @@ - + @@ -1550,7 +1564,9 @@ - + + + @@ -1558,7 +1574,9 @@ - + + + @@ -1573,7 +1591,9 @@ - + + + @@ -1595,7 +1615,9 @@ - + + + @@ -1614,14 +1636,14 @@ + + + - - - @@ -1649,7 +1671,9 @@ - + + + @@ -1665,7 +1689,9 @@ - + + + @@ -1681,7 +1707,9 @@ - + + + @@ -1697,7 +1725,9 @@ - + + + @@ -1826,13 +1856,6 @@ - - - - - - - @@ -1866,15 +1889,15 @@ + + + - - - @@ -1883,6 +1906,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1891,10 +1939,11 @@ - + - - + + + @@ -1902,30 +1951,19 @@ - - - - - - - - + + + - - - - - - - - - - - + + + + + diff --git a/phoneClients/android/app/app.iml b/phoneClients/android/app/app.iml index 8e8cc92..a6f3986 100644 --- a/phoneClients/android/app/app.iml +++ b/phoneClients/android/app/app.iml @@ -79,13 +79,14 @@ - + - - - - - + + + + + + diff --git a/phoneClients/android/app/build.gradle b/phoneClients/android/app/build.gradle index 215eab7..af6ff70 100644 --- a/phoneClients/android/app/build.gradle +++ b/phoneClients/android/app/build.gradle @@ -1,15 +1,15 @@ apply plugin: 'android' android { - compileSdkVersion 20 - buildToolsVersion "20.0.0" + compileSdkVersion 21 + buildToolsVersion "21.1.2" defaultConfig { applicationId "com.websmithing.gpstracker" minSdkVersion 10 - targetSdkVersion 20 - versionCode 13 - versionName "4.0.2" + targetSdkVersion 21 + versionCode 14 + versionName "4.0.3" } buildTypes { release { @@ -22,7 +22,7 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:20.0.0' - compile 'com.loopj.android:android-async-http:1.4.6' - compile 'com.google.android.gms:play-services:4.3.23' + compile 'com.android.support:appcompat-v7:21.0.3' + compile 'com.google.android.gms:play-services:6.5.87' + compile 'com.loopj.android:android-async-http:1.4.9' } diff --git a/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/LocationService.java b/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/LocationService.java index 472dbbe..3d4362d 100644 --- a/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/LocationService.java +++ b/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/LocationService.java @@ -10,11 +10,11 @@ import android.util.Log; import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.GooglePlayServicesClient; import com.google.android.gms.common.GooglePlayServicesUtil; -import com.google.android.gms.location.LocationClient; +import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationRequest; +import com.google.android.gms.location.LocationServices; import com.loopj.android.http.AsyncHttpResponseHandler; import com.loopj.android.http.RequestParams; @@ -25,9 +25,11 @@ import java.util.Date; import java.util.TimeZone; +//import com.google.android.gms.common.GooglePlayServicesUtil; + public class LocationService extends Service implements - GooglePlayServicesClient.ConnectionCallbacks, - GooglePlayServicesClient.OnConnectionFailedListener, + GoogleApiClient.ConnectionCallbacks, + GoogleApiClient.OnConnectionFailedListener, LocationListener { private static final String TAG = "LocationService"; @@ -38,7 +40,7 @@ private boolean currentlyProcessingLocation = false; private LocationRequest locationRequest; - private LocationClient locationClient; + private GoogleApiClient googleApiClient; @Override public void onCreate() { @@ -63,10 +65,15 @@ Log.d(TAG, "startTracking"); if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS) { - locationClient = new LocationClient(this,this,this); - if (!locationClient.isConnected() || !locationClient.isConnecting()) { - locationClient.connect(); + googleApiClient = new GoogleApiClient.Builder(this) + .addApi(LocationServices.API) + .addConnectionCallbacks(this) + .addOnConnectionFailedListener(this) + .build(); + + if (!googleApiClient.isConnected() || !googleApiClient.isConnecting()) { + googleApiClient.connect(); } } else { Log.e(TAG, "unable to connect to google play services."); @@ -140,12 +147,12 @@ LoopjHttpClient.get(uploadWebsite, requestParams, new AsyncHttpResponseHandler() { @Override - public void onSuccess(int statusCode, org.apache.http.Header[] headers, byte[] responseBody) { + public void onSuccess(int statusCode, cz.msebera.android.httpclient.Header[] headers, byte[] responseBody) { LoopjHttpClient.debugLoopJ(TAG, "sendLocationDataToWebsite - success", uploadWebsite, requestParams, responseBody, headers, statusCode, null); stopSelf(); } @Override - public void onFailure(int statusCode, org.apache.http.Header[] headers, byte[] errorResponse, Throwable e) { + public void onFailure(int statusCode, cz.msebera.android.httpclient.Header[] headers, byte[] errorResponse, Throwable e) { LoopjHttpClient.debugLoopJ(TAG, "sendLocationDataToWebsite - failure", uploadWebsite, requestParams, errorResponse, headers, statusCode, e); stopSelf(); } @@ -177,9 +184,8 @@ } private void stopLocationUpdates() { - if (locationClient != null && locationClient.isConnected()) { - locationClient.removeLocationUpdates(this); - locationClient.disconnect(); + if (googleApiClient != null && googleApiClient.isConnected()) { + googleApiClient.disconnect(); } } @@ -197,19 +203,8 @@ locationRequest.setFastestInterval(1000); // the fastest rate in milliseconds at which your app can handle location updates locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); - locationClient.requestLocationUpdates(locationRequest, this); - } - - /** - * Called by Location Services if the connection to the - * location client drops because of an error. - */ - @Override - public void onDisconnected() { - Log.e(TAG, "onDisconnected"); - - stopLocationUpdates(); - stopSelf(); + LocationServices.FusedLocationApi.requestLocationUpdates( + googleApiClient, locationRequest, this); } @Override @@ -219,4 +214,9 @@ stopLocationUpdates(); stopSelf(); } + + @Override + public void onConnectionSuspended(int i) { + Log.e(TAG, "GoogleApiClient connection has been suspend"); + } } diff --git a/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/LoopjHttpClient.java b/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/LoopjHttpClient.java index 2c6453e..2cae24a 100644 --- a/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/LoopjHttpClient.java +++ b/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/LoopjHttpClient.java @@ -6,13 +6,6 @@ import com.loopj.android.http.AsyncHttpResponseHandler; import com.loopj.android.http.RequestParams; -import org.apache.http.Header; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.util.Locale; - public class LoopjHttpClient { private static AsyncHttpClient client = new AsyncHttpClient(); @@ -24,17 +17,19 @@ client.post(url, requestParams, responseHandler); } - public static void debugLoopJ(String TAG, String methodName,String url, RequestParams requestParams, byte[] response, Header[] headers, int statusCode, Throwable t) { + public static void debugLoopJ(String TAG, String methodName,String url, RequestParams requestParams, byte[] response, cz.msebera.android.httpclient.Header[] headers, int statusCode, Throwable t) { Log.d(TAG, client.getUrlWithQueryString(false, url, requestParams)); if (headers != null) { Log.e(TAG, methodName); Log.d(TAG, "Return Headers:"); + /* for (Header h : headers) { String _h = String.format(Locale.US, "%s : %s", h.getName(), h.getValue()); Log.d(TAG, _h); } + */ if (t != null) { Log.d(TAG, "Throwable:" + t); diff --git a/phoneClients/android/build/intermediates/dex-cache/cache.xml b/phoneClients/android/build/intermediates/dex-cache/cache.xml index f3d79c1..3304e81 100644 --- a/phoneClients/android/build/intermediates/dex-cache/cache.xml +++ b/phoneClients/android/build/intermediates/dex-cache/cache.xml @@ -2,40 +2,46 @@ + revision="21.1.2" + sha1="81d42bf983a8741f4888a6e333e454e4a5e0eeb7"/> + revision="21.1.2" + sha1="386a4339ffe52d5d63e80f9bed8d2b1d1a418249"/> + revision="21.1.2" + sha1="526a9f794eab830eae4f23a62c572878b3f491ab"/> + revision="21.1.2" + sha1="01ec05bfbafcc07646ba813000bf2ef11742dd03"/> + revision="21.1.2" + sha1="4b74cefe1f0c1b819e7260c8627a14674e37fd35"/> + revision="21.1.2" + sha1="2c91c949a45a21cdecf26e03951e46c7beec9ad8"/> +