diff --git a/.classpath b/.classpath
index 609aa00..4160c21 100644
--- a/.classpath
+++ b/.classpath
@@ -1,7 +1,8 @@
+
-
-
+
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..b080d2d
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/default.properties b/default.properties
deleted file mode 100644
index 420db56..0000000
--- a/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=Google Inc.:Google APIs:8
diff --git a/project.properties b/project.properties
new file mode 100644
index 0000000..85aac54
--- /dev/null
+++ b/project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-8
diff --git a/res/layout/stored_locations.xml b/res/layout/stored_locations.xml
old mode 100644
new mode 100755
index 1028b4a..2f3db7b
--- a/res/layout/stored_locations.xml
+++ b/res/layout/stored_locations.xml
@@ -2,6 +2,31 @@
+
+
+
+
+
+
+
+
+
enabledProviders = this.locationManager.getProviders(true);
- for (String provider:enabledProviders){
+ for (String provider : enabledProviders) {
Log.i(TAG, "Requesting location updates from provider " + provider);
- this.locationManager.requestLocationUpdates(provider, sampleInterval, sampleDistance, this);
+ this.locationManager.requestLocationUpdates(provider,
+ sampleInterval, sampleDistance, this);
}
}
private void addProximityAlert() {
Log.i(TAG, "addProximityAlert()");
- int vicinityRadius = ((LocationMapperApplication) getApplication()).getPreferences().getVicinityRadius();
- double latitude = ((LocationMapperApplication) getApplication()).getPreferences().getLocation().getLatitude();
- double longitude = ((LocationMapperApplication) getApplication()).getPreferences().getLocation().getLongitude();
+ int vicinityRadius = ((LocationMapperApplication) getApplication())
+ .getPreferences().getVicinityRadius();
+ double latitude = ((LocationMapperApplication) getApplication())
+ .getPreferences().getLocation().getLatitude();
+ double longitude = ((LocationMapperApplication) getApplication())
+ .getPreferences().getLocation().getLongitude();
long expiration = -1;
-Intent intent = new Intent(PROXIMTY_ALERT_INTENT);
-PendingIntent proximityIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
+ Intent intent = new Intent(PROXIMTY_ALERT_INTENT);
+ PendingIntent proximityIntent = PendingIntent.getBroadcast(this, 0,
+ intent, 0);
-locationManager.addProximityAlert(latitude, longitude, vicinityRadius, expiration, proximityIntent);
+ locationManager.addProximityAlert(latitude, longitude, vicinityRadius,
+ expiration, proximityIntent);
-IntentFilter filter = new IntentFilter(PROXIMTY_ALERT_INTENT);
-registerReceiver(this.broadcastReceiver, filter);
+ IntentFilter filter = new IntentFilter(PROXIMTY_ALERT_INTENT);
+ registerReceiver(this.broadcastReceiver, filter);
}
}
diff --git a/src/com/shinetech/android/Preferences.java b/src/com/shinetech/android/Preferences.java
old mode 100644
new mode 100755
index 69aa8bb..1a5daad
--- a/src/com/shinetech/android/Preferences.java
+++ b/src/com/shinetech/android/Preferences.java
@@ -65,7 +65,7 @@ public void load() {
this.location.setAccuracy(sharedPreferences.getFloat("accuracy", 0f));
this.location.setTime(sharedPreferences.getLong("time", 0l));
- this.vicinityRadius = sharedPreferences.getInt("vicinityradius", 0);
+ this.vicinityRadius = sharedPreferences.getInt("vicinityradius", 100);
this.sampleInterval = sharedPreferences.getInt("sampleinterval", 0);
this.sampleDistance = sharedPreferences.getInt("sampledistance", 0);
}
diff --git a/src/com/shinetech/android/ShowStoredLocationActivity.java b/src/com/shinetech/android/ShowStoredLocationActivity.java
old mode 100644
new mode 100755
index afbe060..0eb28a1
--- a/src/com/shinetech/android/ShowStoredLocationActivity.java
+++ b/src/com/shinetech/android/ShowStoredLocationActivity.java
@@ -11,13 +11,19 @@
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
import android.widget.SimpleCursorAdapter;
-public class ShowStoredLocationActivity extends ListActivity {
+public class ShowStoredLocationActivity extends ListActivity implements
+ OnClickListener {
private static final String TAG = "LocationTrackerActivity";
private LocationDbAdapter dbAdapter;
private SimpleCursorAdapter cursorAdapter;
+ private Button stopButton;
+ private Button startButton;
public SimpleCursorAdapter getCursorAdapter() {
return cursorAdapter;
@@ -44,9 +50,12 @@ public void onCreate(Bundle savedInstanceState) {
dbAdapter = new LocationDbAdapter(this);
- ComponentName locationListenerServiceName = new ComponentName(getPackageName(),
- LocationListenerService.class.getName());
- startService(new Intent().setComponent(locationListenerServiceName));
+ stopButton = (Button) findViewById(R.id.stop_button);
+ startButton = (Button) findViewById(R.id.start_button);
+
+ stopButton.setOnClickListener(this);
+ startButton.setOnClickListener(this);
+
}
@Override
@@ -54,11 +63,15 @@ public void onResume() {
Log.i(TAG, "onResume()");
super.onResume();
dbAdapter.open();
- String[] from = { LocationDbAdapter.KEY_NAME, LocationDbAdapter.KEY_LATITUDE, LocationDbAdapter.KEY_LONGITUDE,
+ String[] from = { LocationDbAdapter.KEY_NAME,
+ LocationDbAdapter.KEY_LATITUDE,
+ LocationDbAdapter.KEY_LONGITUDE,
LocationDbAdapter.KEY_ACCURACY, LocationDbAdapter.KEY_TIME };
- int[] to = { R.id.locationname, R.id.locationlatitude, R.id.locationlongitude, R.id.locationaccuracy,
+ int[] to = { R.id.locationname, R.id.locationlatitude,
+ R.id.locationlongitude, R.id.locationaccuracy,
R.id.locationtime };
- cursorAdapter = new LocationCursorAdapter(this, R.layout.stored_locations_row_layout,
+ cursorAdapter = new LocationCursorAdapter(this,
+ R.layout.stored_locations_row_layout,
dbAdapter.fetchAllLocations(), from, to);
this.setListAdapter(cursorAdapter);
IntentFilter intentFilter = new IntentFilter();
@@ -93,4 +106,16 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
}
+ @Override
+ public void onClick(View v) {
+ ComponentName locationListenerServiceName = new ComponentName(
+ getPackageName(), LocationListenerService.class.getName());
+ Intent i = new Intent().setComponent(locationListenerServiceName);
+
+ if (v.getId() == R.id.start_button) {
+ startService(i);
+ } else if (v.getId() == R.id.stop_button) {
+ stopService(i);
+ }
+ }
}
\ No newline at end of file