I have moved all static keys from individual service classes to

LocationLibraryConstants

closes #112

Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
2012-06-21 09:33:30 -04:00
parent 2a30cca952
commit d53fe7bdd5
4 changed files with 20 additions and 41 deletions

Binary file not shown.

View File

@@ -20,7 +20,6 @@ import android.util.Log;
import com.TwentyCodes.android.debug.LocationLibraryConstants;
import com.TwentyCodes.android.location.GeoPointLocationListener;
import com.TwentyCodes.android.location.BaseLocationReceiver;
import com.google.android.maps.GeoPoint;
import com.skyhookwireless.wps.RegistrationCallback;
import com.skyhookwireless.wps.WPSContinuation;
@@ -38,22 +37,6 @@ import com.skyhookwireless.wps.WPSReturnCode;
* @author ricky barrette
*/
public class SkyHookService extends Service implements GeoPointLocationListener, RegistrationCallback{
/**
* Used to tell the service how frequently it needs to run. This is required if you want a multishot service
*/
public static final String INTENT_EXTRA_PERIOD_BETWEEN_UPDATES = "period_beween_updates";
/**
* Used to tell the service how accurate of a location you want reported
*/
public static final String INTENT_EXTRA_REQUIRED_ACCURACY = "required_accuracy";
/**
* Used to tell the service the update action to broadcast. If this is not supplied, {@link BaseLocationReceiver.INTENT_EXTRA_ACTION_UPDATE } will be used.
* @see BaseLocationReceiver.INTENT_EXTRA_ACTION_UPDATE
*/
public static final String INTENT_EXTRA_ACTION_UPDATE = "action_update";
public static final String TAG = "SkyHookService";
public static final int REQUEST_CODE = 32741942;
@@ -178,11 +161,11 @@ public class SkyHookService extends Service implements GeoPointLocationListener,
this.mIntent = intent;
if(intent != null){
if (intent.hasExtra(INTENT_EXTRA_PERIOD_BETWEEN_UPDATES))
mPeriod = intent.getLongExtra(INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, 60000L);
if (intent.hasExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES))
mPeriod = intent.getLongExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, 60000L);
if (intent.hasExtra(INTENT_EXTRA_REQUIRED_ACCURACY))
mRequiredAccuracy = intent.getIntExtra(INTENT_EXTRA_REQUIRED_ACCURACY, -1);
if (intent.hasExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY))
mRequiredAccuracy = intent.getIntExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, -1);
}
}

View File

@@ -6,6 +6,8 @@
*/
package com.TwentyCodes.android.debug;
import com.TwentyCodes.android.location.BaseLocationReceiver;
import android.hardware.SensorManager;
import android.location.LocationManager;
@@ -58,4 +60,14 @@ public final class LocationLibraryConstants {
public static final String INTENT_ACTION_UPDATE = "TwentyCodes.intent.action.LocationUpdate";
public static final String INTENT_EXTRA_LOCATION_CHANGED = LocationManager.KEY_LOCATION_CHANGED;
/**
* Used to tell the service how frequently it needs to run. This is required if you want a multishot service
*/
public static final String INTENT_EXTRA_PERIOD_BETWEEN_UPDATES = "period_beween_updates";
/**
* Used to tell the service how accurate of a location you want reported
*/
public static final String INTENT_EXTRA_REQUIRED_ACCURACY = "required_accuracy";
}

View File

@@ -37,22 +37,6 @@ import com.TwentyCodes.android.debug.LocationLibraryConstants;
* @author ricky barrette
*/
public class LocationService extends Service implements LocationListener {
/**
* Used to tell the service how frequently it needs to run. This is required if you want a multishot service
*/
public static final String INTENT_EXTRA_PERIOD_BETWEEN_UPDATES = "period_beween_updates";
/**
* Used to tell the service how accurate of a location you want reported
*/
public static final String INTENT_EXTRA_REQUIRED_ACCURACY = "required_accuracy";
/**
* Used to tell the service the update action to broadcast. If this is not supplied, {@link BaseLocationReceiver.INTENT_EXTRA_ACTION_UPDATE } will be used.
* @see BaseLocationReceiver.INTENT_EXTRA_ACTION_UPDATE
*/
public static final String INTENT_EXTRA_ACTION_UPDATE = "action_update";
public static final String TAG = "LocationService";
private static final int REQUEST_CODE = 7893749;
@@ -180,11 +164,11 @@ public class LocationService extends Service implements LocationListener {
this.mIntent = intent;
if (intent.hasExtra(INTENT_EXTRA_PERIOD_BETWEEN_UPDATES))
mPeriod = intent.getLongExtra(INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, 60000L);
if (intent.hasExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES))
mPeriod = intent.getLongExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, 60000L);
if (intent.hasExtra(INTENT_EXTRA_REQUIRED_ACCURACY))
mRequiredAccuracy = intent.getIntExtra(INTENT_EXTRA_REQUIRED_ACCURACY, -1);
if (intent.hasExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY))
mRequiredAccuracy = intent.getIntExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, -1);
}
/**