diff --git a/phoneClients/android/.idea/gradle.xml b/phoneClients/android/.idea/gradle.xml index aa006ab..0c341e5 100644 --- a/phoneClients/android/.idea/gradle.xml +++ b/phoneClients/android/.idea/gradle.xml @@ -5,6 +5,12 @@ diff --git a/phoneClients/android/.idea/libraries/ComAndroidSupportAppcompatV71900_aar.xml b/phoneClients/android/.idea/libraries/ComAndroidSupportAppcompatV71900_aar.xml deleted file mode 100644 index 2a05343..0000000 --- a/phoneClients/android/.idea/libraries/ComAndroidSupportAppcompatV71900_aar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/ComAndroidSupportAppcompatV71901_aar.xml b/phoneClients/android/.idea/libraries/ComAndroidSupportAppcompatV71901_aar.xml new file mode 100644 index 0000000..be301f2 --- /dev/null +++ b/phoneClients/android/.idea/libraries/ComAndroidSupportAppcompatV71901_aar.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/ComGoogleAndroidGmsPlayServices4030_aar.xml b/phoneClients/android/.idea/libraries/ComGoogleAndroidGmsPlayServices4030_aar.xml index 7c84dc8..0997482 100644 --- a/phoneClients/android/.idea/libraries/ComGoogleAndroidGmsPlayServices4030_aar.xml +++ b/phoneClients/android/.idea/libraries/ComGoogleAndroidGmsPlayServices4030_aar.xml @@ -2,6 +2,7 @@ + diff --git a/phoneClients/android/.idea/libraries/Gradle__ComAndroidSupportAppcompatV71901_aar.xml b/phoneClients/android/.idea/libraries/Gradle__ComAndroidSupportAppcompatV71901_aar.xml new file mode 100644 index 0000000..93493c7 --- /dev/null +++ b/phoneClients/android/.idea/libraries/Gradle__ComAndroidSupportAppcompatV71901_aar.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/Gradle__ComGoogleAndroidGmsPlayServices4030_aar.xml b/phoneClients/android/.idea/libraries/Gradle__ComGoogleAndroidGmsPlayServices4030_aar.xml new file mode 100644 index 0000000..80493dd --- /dev/null +++ b/phoneClients/android/.idea/libraries/Gradle__ComGoogleAndroidGmsPlayServices4030_aar.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/Gradle__android_async_http_1_4_4.xml b/phoneClients/android/.idea/libraries/Gradle__android_async_http_1_4_4.xml new file mode 100644 index 0000000..91ea9f8 --- /dev/null +++ b/phoneClients/android/.idea/libraries/Gradle__android_async_http_1_4_4.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/Gradle__support_v4_19_0_1.xml b/phoneClients/android/.idea/libraries/Gradle__support_v4_19_0_1.xml new file mode 100644 index 0000000..185a30f --- /dev/null +++ b/phoneClients/android/.idea/libraries/Gradle__support_v4_19_0_1.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/support_v4_19_0_0.xml b/phoneClients/android/.idea/libraries/support_v4_19_0_0.xml deleted file mode 100644 index 0279a24..0000000 --- a/phoneClients/android/.idea/libraries/support_v4_19_0_0.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/phoneClients/android/.idea/libraries/support_v4_19_0_1.xml b/phoneClients/android/.idea/libraries/support_v4_19_0_1.xml new file mode 100644 index 0000000..b335e5e --- /dev/null +++ b/phoneClients/android/.idea/libraries/support_v4_19_0_1.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 5f992c9..1c97330 100644 --- a/phoneClients/android/.idea/workspace.xml +++ b/phoneClients/android/.idea/workspace.xml @@ -40,8 +40,19 @@ + + + + + + + + + + + @@ -111,8 +122,10 @@ - - + + + + @@ -120,7 +133,7 @@ - + @@ -132,7 +145,7 @@ - + @@ -189,11 +202,11 @@ - - @@ -449,9 +462,9 @@ - @@ -992,7 +1000,7 @@ - + @@ -1001,16 +1009,16 @@ - - + + - - + + @@ -1050,7 +1058,7 @@ - @@ -1069,10 +1077,52 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1108,7 +1158,9 @@ - + + + @@ -1146,7 +1198,9 @@ - + + + @@ -1167,7 +1221,9 @@ - + + + @@ -1188,7 +1244,9 @@ - + + + @@ -1212,7 +1270,9 @@ - + + + @@ -1243,7 +1303,9 @@ - + + + @@ -1291,7 +1353,9 @@ - + + + @@ -1326,16 +1390,6 @@ - - - - - - - - - - @@ -1386,14 +1440,24 @@ - + + + + + + + + + + + - + @@ -1403,8 +1467,10 @@ - - + + + + diff --git a/phoneClients/android/GpsTracker/GpsTracker.iml b/phoneClients/android/GpsTracker/GpsTracker.iml index 9281d30..7fbe37f 100644 --- a/phoneClients/android/GpsTracker/GpsTracker.iml +++ b/phoneClients/android/GpsTracker/GpsTracker.iml @@ -1,5 +1,5 @@ - + @@ -72,8 +72,8 @@ - - + + diff --git a/phoneClients/android/GpsTracker/src/main/java/com/websmithing/gpstracker/GpsTrackerActivity.java b/phoneClients/android/GpsTracker/src/main/java/com/websmithing/gpstracker/GpsTrackerActivity.java index 03d0f58..aedcfb9 100644 --- a/phoneClients/android/GpsTracker/src/main/java/com/websmithing/gpstracker/GpsTrackerActivity.java +++ b/phoneClients/android/GpsTracker/src/main/java/com/websmithing/gpstracker/GpsTrackerActivity.java @@ -52,11 +52,11 @@ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(android.R.layout.activity_gpstracker); + setContentView(R.layout.activity_gpstracker); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() - .add(android.R.id.container, new PlaceholderFragment()) + .add(R.id.container, new PlaceholderFragment()) .commit(); } @@ -70,50 +70,38 @@ } } - // called when trackingButton is tapped - public void startOrStopTracking(View v) { + // called when startTrackingButton is tapped + public void trackLocation(View v) { if (currentlyTracking) { + ((Button) v).setText("start tracking"); stopTracking(); currentlyTracking = false; } else { + ((Button) v).setText("stop tracking"); startTracking(); currentlyTracking = true; } } - public void startTracking() { - Log.e(TAG, "startTracking"); - ((Button) v).setText("stop tracking"); - + protected void startTracking() { sessionID = UUID.randomUUID().toString(); sessionIDTextView.setText("sessionID: " + sessionID); - totalDistanceInMeters = 0.0f; + totalDistanceInMeters = 0.0f; + int intervalInSeconds = 60; // one minute locationRequest = LocationRequest.create(); - locationRequest.setInterval(60 * 1000); - locationRequest.setFastestInterval(60 * 1000); // the fastest rate in milliseconds at which your app can handle location updates + locationRequest.setInterval(intervalInSeconds * 1000); + locationRequest.setFastestInterval(intervalInSeconds * 1000); // the fastest rate in milliseconds at which your app can handle location updates locationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); locationClient.requestLocationUpdates(locationRequest, this); } - public void stopTracking() { - Log.e(TAG, "stopTracking"); - ((Button) v).setText("start tracking"); - - sessionIDTextView.setText("sessionID:"); - } - - protected void changeInterval(int intervalInMinutes) { - locationRequest.setInterval(intervalInMinutes * 1000); - locationRequest.setFastestInterval(intervalInMinutes * 1000); - } - - protected void oneTimeLocationUpdate() { - Log.e(TAG, "oneTimeLocationUpdate"); + protected void stopTracking() { + sessionIDTextView.setText("sessionID: "); if (locationClient != null && locationClient.isConnected()) { - Location location = locationClient.getLastLocation(); - displayLocationData(location); + locationClient.removeLocationUpdates(this); + locationClient.disconnect(); } } @@ -221,7 +209,6 @@ @Override public void onConnected(Bundle bundle) { Log.e(TAG, "onConnected"); - } /** @@ -231,18 +218,16 @@ @Override public void onDisconnected() { Log.e(TAG, "onDisconnected"); - } @Override public void onConnectionFailed(ConnectionResult connectionResult) { Log.e(TAG, "onConnectionFailed"); - } @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(android.R.menu.gps_tracker, menu); + getMenuInflater().inflate(R.menu.gps_tracker, menu); return true; } @@ -252,27 +237,26 @@ // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { - case android.R.id.action_settings: + case R.id.action_settings: return true; } return super.onOptionsItemSelected(item); } public static class PlaceholderFragment extends Fragment { - public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View rootView = inflater.inflate(android.R.layout.fragment_gpstracker, container, false); - longitudeTextView = (TextView)rootView.findViewById(android.R.id.longitudeTextView); - latitudeTextView = (TextView)rootView.findViewById(android.R.id.latitudeTextView); - accuracyTextView = (TextView)rootView.findViewById(android.R.id.accuracyTextView); - providerTextView = (TextView)rootView.findViewById(android.R.id.providerTextView); - timeStampTextView = (TextView)rootView.findViewById(android.R.id.timeStampTextView); - sessionIDTextView = (TextView)rootView.findViewById(android.R.id.sessionIDTextView); + View rootView = inflater.inflate(R.layout.fragment_gpstracker, container, false); + longitudeTextView = (TextView)rootView.findViewById(R.id.longitudeTextView); + latitudeTextView = (TextView)rootView.findViewById(R.id.latitudeTextView); + accuracyTextView = (TextView)rootView.findViewById(R.id.accuracyTextView); + providerTextView = (TextView)rootView.findViewById(R.id.providerTextView); + timeStampTextView = (TextView)rootView.findViewById(R.id.timeStampTextView); + sessionIDTextView = (TextView)rootView.findViewById(R.id.sessionIDTextView); return rootView; } } diff --git a/phoneClients/android/GpsTracker/src/main/res/layout/fragment_gpstracker.xml b/phoneClients/android/GpsTracker/src/main/res/layout/fragment_gpstracker.xml index ec2d99d..62ea9ed 100644 --- a/phoneClients/android/GpsTracker/src/main/res/layout/fragment_gpstracker.xml +++ b/phoneClients/android/GpsTracker/src/main/res/layout/fragment_gpstracker.xml @@ -53,7 +53,7 @@