diff --git a/LocationRinger/AndroidManifest.xml b/LocationRinger/AndroidManifest.xml
index e4321bb..1c2914c 100644
--- a/LocationRinger/AndroidManifest.xml
+++ b/LocationRinger/AndroidManifest.xml
@@ -7,11 +7,6 @@
-
-
-
-
-
@@ -19,26 +14,19 @@
android:name="android.hardware.location.gps"
android:required="false" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+ android:configChanges="keyboard|orientation" />
-
-
-
-
-
-
+
+
+
-
-
+
-
+ android:process=":LocationService" />
-
+ android:process=":RingerProcessingService" />
-
+ android:enabled="true" />
-
+ android:configChanges="keyboard|orientation" />
-
+ android:screenOrientation="portrait" />
-
-
+
-
+ android:exported="true"
+ android:process=":PassiveLocationChangedReceiver" />
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java
index 41d0784..5716ffd 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java
@@ -18,6 +18,7 @@ import com.TwentyCodes.android.LocationRinger.R;
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.debug.LocationLibraryConstants;
/**
* This widget will be used to force a Location update from the users home screen
@@ -48,7 +49,7 @@ public final String TAG = "GetLocationWidget";
Intent intent = new Intent(context, LocationService.class)
.putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(context.getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_WORLD_READABLE).getString(SettingsActivity.ACCURACY , "50")))
- .setAction(LocationReceiver.LR_ACTION_UPDATE);
+ .setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
//create a pending intent to start the post activity
PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0);
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationReceiver.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java
similarity index 77%
rename from LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationReceiver.java
rename to LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java
index ef89a25..be9cae1 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationReceiver.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java
@@ -14,21 +14,22 @@ import android.util.Log;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.services.RingerProcessingService;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
+import com.TwentyCodes.android.debug.LocationLibraryConstants;
+import com.TwentyCodes.android.location.BaseLocationReceiver;
/**
* This class will receive broadcast from the location service. it will wake the ringer processing service.
* @author ricky barrette
*/
-public class LocationReceiver extends com.TwentyCodes.android.location.LocationReceiver {
+public class LocationChangedReceiver extends BaseLocationReceiver {
- public static final String LR_ACTION_UPDATE = "com.TwentyCodes.android.LocationRinger.action.LocationUpdate";
- private static final String TAG = "LocationReceiver";
+ protected static String TAG = "LocationReceiver";
@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(INTENT_EXTRA_LOCATION_PARCEL, location));
+ mContext.startService(new Intent(mContext, RingerProcessingService.class).putExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED, location));
else
if(Debug.DEBUG)
Log.d(TAG, "location accuracy = "+ location.getAccuracy()+" ignoring");
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/PassiveLocationChangedReceiver.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/PassiveLocationChangedReceiver.java
index f0a4680..5af25c7 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/PassiveLocationChangedReceiver.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/PassiveLocationChangedReceiver.java
@@ -6,37 +6,14 @@
*/
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
+ * This class will be used to listen for location updates passively.
* @author ricky barrette
*/
-public class PassiveLocationChangedReceiver extends com.TwentyCodes.android.location.PassiveLocationChangedReceiver {
+public class PassiveLocationChangedReceiver extends LocationChangedReceiver {
- 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");
+ static{
+ TAG = "PassiveLocationChangedReceiver";
}
+
}
\ 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 8b46dc2..6968153 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.debug.LocationLibraryConstants;
import com.TwentyCodes.android.location.PassiveLocationListener;
/**
@@ -45,7 +46,7 @@ public class SystemReceiver extends BroadcastReceiver {
Intent i = new Intent(context, LocationService.class)
// .putExtra(LocationService.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, (long) (60000 * Integer.parseInt(context.getSharedPreferences(SettingsActivity.SETTINGS, 2).getString(SettingsActivity.UPDATE_INTVERVAL , "10"))))
.putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(context.getSharedPreferences(SettingsActivity.SETTINGS, 2).getString(SettingsActivity.ACCURACY , "50")))
- .setAction(LocationReceiver.LR_ACTION_UPDATE);
+ .setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
/*
* if the phone finishes booting, then start the service if the user enabled it
@@ -53,7 +54,7 @@ public class SystemReceiver extends BroadcastReceiver {
if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
if(context.getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_WORLD_READABLE).getBoolean(SettingsActivity.START_ON_BOOT, false)){
context.startService(i);
- PassiveLocationListener.requestPassiveLocationUpdates(context);
+ PassiveLocationListener.requestPassiveLocationUpdates(context, new Intent(context, PassiveLocationChangedReceiver.class));
}
}
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java
index de9822d..3176407 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java
@@ -31,8 +31,9 @@ import android.widget.Toast;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
-import com.TwentyCodes.android.LocationRinger.receivers.LocationReceiver;
+import com.TwentyCodes.android.LocationRinger.receivers.LocationChangedReceiver;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
+import com.TwentyCodes.android.debug.LocationLibraryConstants;
import com.TwentyCodes.android.exception.ExceptionHandler;
import com.TwentyCodes.android.location.GeoUtils;
import com.google.android.maps.GeoPoint;
@@ -147,7 +148,7 @@ public class RingerProcessingService extends Service {
if (values.get(RingerDatabase.KEY_UPDATE_INTERVAL) != null){
Intent i = new Intent(this, LocationService.class)
.putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(this.getSharedPreferences(SettingsActivity.SETTINGS, 2).getString(SettingsActivity.ACCURACY , "50")))
- .setAction(LocationReceiver.LR_ACTION_UPDATE);
+ .setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
PendingIntent pi = PendingIntent.getService(this, LocationService.REQUEST_CODE, i, 0);
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
@@ -294,8 +295,8 @@ public class RingerProcessingService extends Service {
// backup();
// }
- if(intent.getParcelableExtra(LocationReceiver.INTENT_EXTRA_LOCATION_PARCEL) != null){
- this.mLocation = intent.getParcelableExtra(LocationReceiver.INTENT_EXTRA_LOCATION_PARCEL);
+ if(intent.getParcelableExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED) != null){
+ this.mLocation = intent.getParcelableExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED);
processRingers();
}else if(Debug.DEBUG)
Log.d(TAG, "Location was null");
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java
index 9de0fbd..99238e7 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java
@@ -31,10 +31,12 @@ import android.widget.Toast;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.db.DatabaseListener;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
-import com.TwentyCodes.android.LocationRinger.receivers.LocationReceiver;
+import com.TwentyCodes.android.LocationRinger.receivers.LocationChangedReceiver;
+import com.TwentyCodes.android.LocationRinger.receivers.PassiveLocationChangedReceiver;
import com.TwentyCodes.android.LocationRinger.services.LocationService;
import com.TwentyCodes.android.SkyHook.SkyHookRegistration;
import com.TwentyCodes.android.SkyHook.Splash;
+import com.TwentyCodes.android.debug.LocationLibraryConstants;
import com.TwentyCodes.android.location.PassiveLocationListener;
import com.skyhookwireless.wps.RegistrationCallback;
import com.skyhookwireless.wps.WPSContinuation;
@@ -210,7 +212,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
@Override
protected void onDestroy() {
restartService();
- PassiveLocationListener.requestPassiveLocationUpdates(this);
+ PassiveLocationListener.requestPassiveLocationUpdates(this, new Intent(this, PassiveLocationChangedReceiver.class));
super.onDestroy();
}
@@ -334,7 +336,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
//start the new service
Intent i = new Intent(this, LocationService.class)
.putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(this.getSharedPreferences(SettingsActivity.SETTINGS, 2).getString(SettingsActivity.ACCURACY , "50")))
- .setAction(LocationReceiver.LR_ACTION_UPDATE);
+ .setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
this.startService(i);
}