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:
Binary file not shown.
@@ -20,7 +20,6 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.TwentyCodes.android.debug.LocationLibraryConstants;
|
import com.TwentyCodes.android.debug.LocationLibraryConstants;
|
||||||
import com.TwentyCodes.android.location.GeoPointLocationListener;
|
import com.TwentyCodes.android.location.GeoPointLocationListener;
|
||||||
import com.TwentyCodes.android.location.BaseLocationReceiver;
|
|
||||||
import com.google.android.maps.GeoPoint;
|
import com.google.android.maps.GeoPoint;
|
||||||
import com.skyhookwireless.wps.RegistrationCallback;
|
import com.skyhookwireless.wps.RegistrationCallback;
|
||||||
import com.skyhookwireless.wps.WPSContinuation;
|
import com.skyhookwireless.wps.WPSContinuation;
|
||||||
@@ -39,22 +38,6 @@ import com.skyhookwireless.wps.WPSReturnCode;
|
|||||||
*/
|
*/
|
||||||
public class SkyHookService extends Service implements GeoPointLocationListener, RegistrationCallback{
|
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 String TAG = "SkyHookService";
|
||||||
public static final int REQUEST_CODE = 32741942;
|
public static final int REQUEST_CODE = 32741942;
|
||||||
private SkyHook mSkyhook;
|
private SkyHook mSkyhook;
|
||||||
@@ -178,11 +161,11 @@ public class SkyHookService extends Service implements GeoPointLocationListener,
|
|||||||
this.mIntent = intent;
|
this.mIntent = intent;
|
||||||
|
|
||||||
if(intent != null){
|
if(intent != null){
|
||||||
if (intent.hasExtra(INTENT_EXTRA_PERIOD_BETWEEN_UPDATES))
|
if (intent.hasExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES))
|
||||||
mPeriod = intent.getLongExtra(INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, 60000L);
|
mPeriod = intent.getLongExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, 60000L);
|
||||||
|
|
||||||
if (intent.hasExtra(INTENT_EXTRA_REQUIRED_ACCURACY))
|
if (intent.hasExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY))
|
||||||
mRequiredAccuracy = intent.getIntExtra(INTENT_EXTRA_REQUIRED_ACCURACY, -1);
|
mRequiredAccuracy = intent.getIntExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.TwentyCodes.android.debug;
|
package com.TwentyCodes.android.debug;
|
||||||
|
|
||||||
|
import com.TwentyCodes.android.location.BaseLocationReceiver;
|
||||||
|
|
||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
import android.location.LocationManager;
|
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_ACTION_UPDATE = "TwentyCodes.intent.action.LocationUpdate";
|
||||||
|
|
||||||
public static final String INTENT_EXTRA_LOCATION_CHANGED = LocationManager.KEY_LOCATION_CHANGED;
|
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";
|
||||||
}
|
}
|
||||||
@@ -38,22 +38,6 @@ import com.TwentyCodes.android.debug.LocationLibraryConstants;
|
|||||||
*/
|
*/
|
||||||
public class LocationService extends Service implements LocationListener {
|
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";
|
public static final String TAG = "LocationService";
|
||||||
private static final int REQUEST_CODE = 7893749;
|
private static final int REQUEST_CODE = 7893749;
|
||||||
private WakeLock mWakeLock;
|
private WakeLock mWakeLock;
|
||||||
@@ -180,11 +164,11 @@ public class LocationService extends Service implements LocationListener {
|
|||||||
|
|
||||||
this.mIntent = intent;
|
this.mIntent = intent;
|
||||||
|
|
||||||
if (intent.hasExtra(INTENT_EXTRA_PERIOD_BETWEEN_UPDATES))
|
if (intent.hasExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES))
|
||||||
mPeriod = intent.getLongExtra(INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, 60000L);
|
mPeriod = intent.getLongExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, 60000L);
|
||||||
|
|
||||||
if (intent.hasExtra(INTENT_EXTRA_REQUIRED_ACCURACY))
|
if (intent.hasExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY))
|
||||||
mRequiredAccuracy = intent.getIntExtra(INTENT_EXTRA_REQUIRED_ACCURACY, -1);
|
mRequiredAccuracy = intent.getIntExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user