diff --git a/LocationRinger/AndroidManifest.xml b/LocationRinger/AndroidManifest.xml
index f07e857..e4321bb 100644
--- a/LocationRinger/AndroidManifest.xml
+++ b/LocationRinger/AndroidManifest.xml
@@ -9,10 +9,16 @@
-
-
-
-
+
+
+
+
+
+
@@ -121,6 +127,12 @@
+
+
+
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/PassiveLocationChangedReceiver.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/PassiveLocationChangedReceiver.java
new file mode 100644
index 0000000..f0a4680
--- /dev/null
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/PassiveLocationChangedReceiver.java
@@ -0,0 +1,42 @@
+/**
+ * PassiveLocationChangedReceiver.java
+ * @date May 15, 2012
+ * @author ricky barrette
+ * @author Twenty Codes, LLC
+ */
+package com.TwentyCodes.android.LocationRinger.receivers;
+
+import com.TwentyCodes.android.LocationRinger.debug.Debug;
+import com.TwentyCodes.android.LocationRinger.services.RingerProcessingService;
+import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
+
+import android.content.Context;
+import android.content.Intent;
+import android.location.Location;
+import android.util.Log;
+
+/**
+ * This class will be used to listen for location updates passively
+ * @author ricky barrette
+ */
+public class PassiveLocationChangedReceiver extends com.TwentyCodes.android.location.PassiveLocationChangedReceiver {
+
+ private static final String TAG = "PassiveLocationChangedReceiver";
+
+ /**
+ * (non-Javadoc)
+ * @see com.TwentyCodes.android.location.PassiveLocationChangedReceiver#onLocationUpdate(android.location.Location)
+ */
+ @Override
+ public void onLocationUpdate(Location location) {
+ if(location != null)
+ if(location.getAccuracy()<= Integer.parseInt(mContext.getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_PRIVATE).getString(SettingsActivity.IGNORE_LOCATION, "1000")))
+ mContext.startService(new Intent(mContext, RingerProcessingService.class).putExtra(LocationReceiver.INTENT_EXTRA_LOCATION_PARCEL, location));
+ else
+ if(Debug.DEBUG)
+ Log.d(TAG, "location accuracy = "+ location.getAccuracy()+" ignoring");
+ else
+ if(Debug.DEBUG)
+ Log.d(TAG, "location was null");
+ }
+}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java
index ca0503f..8b46dc2 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java
@@ -16,6 +16,7 @@ import android.util.Log;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.services.LocationService;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
+import com.TwentyCodes.android.location.PassiveLocationListener;
/**
* This receiver will system events
@@ -50,8 +51,10 @@ public class SystemReceiver extends BroadcastReceiver {
* if the phone finishes booting, then start the service if the user enabled it
*/
if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
- if(context.getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_WORLD_READABLE).getBoolean(SettingsActivity.START_ON_BOOT, false))
+ if(context.getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_WORLD_READABLE).getBoolean(SettingsActivity.START_ON_BOOT, false)){
context.startService(i);
+ PassiveLocationListener.requestPassiveLocationUpdates(context);
+ }
}
/*
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java
index 30c72c9..9de0fbd 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java
@@ -35,6 +35,7 @@ import com.TwentyCodes.android.LocationRinger.receivers.LocationReceiver;
import com.TwentyCodes.android.LocationRinger.services.LocationService;
import com.TwentyCodes.android.SkyHook.SkyHookRegistration;
import com.TwentyCodes.android.SkyHook.Splash;
+import com.TwentyCodes.android.location.PassiveLocationListener;
import com.skyhookwireless.wps.RegistrationCallback;
import com.skyhookwireless.wps.WPSContinuation;
import com.skyhookwireless.wps.WPSReturnCode;
@@ -209,6 +210,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
@Override
protected void onDestroy() {
restartService();
+ PassiveLocationListener.requestPassiveLocationUpdates(this);
super.onDestroy();
}