diff --git a/TravelPost/.classpath b/TravelPost/.classpath
index b450f30..a66f012 100644
--- a/TravelPost/.classpath
+++ b/TravelPost/.classpath
@@ -5,5 +5,11 @@
+
+
+
+
+
+
diff --git a/TravelPost/.codepro/deadCodeEntryPoints.xml b/TravelPost/.codepro/deadCodeEntryPoints.xml
new file mode 100644
index 0000000..814d580
--- /dev/null
+++ b/TravelPost/.codepro/deadCodeEntryPoints.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TravelPost/.project b/TravelPost/.project
index 09a8d0b..68cba3e 100644
--- a/TravelPost/.project
+++ b/TravelPost/.project
@@ -36,5 +36,10 @@
2_android_FacebookLib_9c84f9bf/src
+
+ LocationLib_src
+ 2
+ _android_LocationLib_84551a70/src
+
diff --git a/TravelPost/default.properties b/TravelPost/default.properties
index 3d3665e..af7b5fb 100644
--- a/TravelPost/default.properties
+++ b/TravelPost/default.properties
@@ -12,3 +12,4 @@ target=Google Inc.:Google APIs:9
proguard.config=proguard.cfg
android.library.reference.1=../FacebookLib/
+android.library.reference.2=../LocationLib
diff --git a/TravelPost/gen/com/TwentyCodes/android/TravelPost/R.java b/TravelPost/gen/com/TwentyCodes/android/TravelPost/R.java
index a81f12e..0c7329c 100644
--- a/TravelPost/gen/com/TwentyCodes/android/TravelPost/R.java
+++ b/TravelPost/gen/com/TwentyCodes/android/TravelPost/R.java
@@ -13,23 +13,35 @@ public final class R {
public static final class drawable {
public static final int facebook_icon=0x7f020000;
public static final int icon=0x7f020001;
- public static final int sign_post_icon=0x7f020002;
- public static final int sign_post_icon_mod=0x7f020003;
+ public static final int logoidea3=0x7f020002;
+ public static final int sign_post_icon=0x7f020003;
+ public static final int sign_post_icon_mod=0x7f020004;
+ public static final int skyhook_logo=0x7f020005;
+ public static final int skyhook_logo_alpha=0x7f020006;
+ public static final int skyhook_logo_alpha_small=0x7f020007;
+ public static final int tc_logo_complete=0x7f020008;
+ public static final int user=0x7f020009;
}
public static final class id {
- public static final int authCode=0x7f060002;
- public static final int authOkButton=0x7f060001;
- public static final int authWebView=0x7f060003;
- public static final int widgetbutton=0x7f060000;
+ public static final int authCode=0x7f060005;
+ public static final int authOkButton=0x7f060004;
+ public static final int authWebView=0x7f060006;
+ public static final int skyhook_img=0x7f060000;
+ public static final int tc_img=0x7f060002;
+ public static final int text=0x7f060001;
+ public static final int widgetbutton=0x7f060003;
}
public static final class layout {
public static final int main=0x7f030000;
- public static final int travelpostwidget=0x7f030001;
- public static final int webauth=0x7f030002;
+ public static final int powered_by_skyhook=0x7f030001;
+ public static final int travelpostwidget=0x7f030002;
+ public static final int webauth=0x7f030003;
}
public static final class string {
- public static final int app_name=0x7f050001;
- public static final int hello=0x7f050000;
+ public static final int app_name=0x7f050000;
+ public static final int gps_fix=0x7f050001;
+ public static final int hello=0x7f050003;
+ public static final int sorry_theres_trouble=0x7f050002;
}
public static final class xml {
public static final int settings=0x7f040000;
diff --git a/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationReceiver.java b/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationReceiver.java
index 0087e2d..c198afb 100644
--- a/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationReceiver.java
+++ b/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationReceiver.java
@@ -6,6 +6,8 @@
*/
package com.TwentyCodes.android.TravelPost;
+import com.TwentyCodes.android.location.ReverseGeocoder;
+
import twitter4j.TwitterException;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -47,7 +49,7 @@ public class LocationReceiver extends BroadcastReceiver{
//TODO something with the location i.e. report location to social services like twitter, ect...
try {
- Log.d(TravelPost.TAG, TwitterServices.tweet(mContext, ReverseGeocode.getAddressFromLocation(location)).toString());
+ Log.d(TravelPost.TAG, TwitterServices.tweet(mContext, ReverseGeocoder.getAddressFromLocation(location)).toString());
} catch (TwitterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationService.java b/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationService.java
deleted file mode 100644
index 4eb0474..0000000
--- a/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationService.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/**
- * LocationService.java
- * @date Jan 21, 2011
- * @author ricky barrette
- * @author Twenty Codes, LLC
- */
-package com.TwentyCodes.android.TravelPost;
-
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.PowerManager;
-import android.os.PowerManager.WakeLock;
-import android.util.Log;
-
-/**
- * A service that will gather the user's location in the background, and report it via Broadcast once the location gathered has reached the
- * @author ricky barrette
- */
-public class LocationService extends Service implements LocationListener {
-
- /**
- * The desired accuracy in meters
- */
- private static final float DESIRED_ACCURACY = 12.0f;
-
- /**
- * Maximum running time in milliseconds
- */
- private final long MAX_RUN_TIME = 180000L;
-
- private static final int SIMPLE_NOTFICATION_ID = 234098752;
- private LocationManager mLocationManager;
- private WakeLock mWakeLock;
- private Location mLocation;
- private int mStartId;
- private Notification mNotification;
- private NotificationManager mNotificationManager;
-
- /**
- * this runnable will be qued when the service is created. this will be used as a fail safe
- * @author ricky barrette
- */
- private Runnable mFailSafe = new Runnable() {
- @Override
- public void run(){
- stopSelf(mStartId);
- }
- };
-
- /**
- * a convince method for starting the service
- * @param context
- * @return a runnable that will start the service
- * @author ricky barrette
- */
- public static Intent startService(final Context context){
- return new Intent(context, LocationService.class);
- }
-
- /**
- * a convince method for stopping the service
- * @param context
- * @return a runnable that will stop the service
- * @author ricky barrette
- */
- public static Runnable stopService(final Context context){
- return new Runnable(){
- @Override
- public void run(){
- context.stopService(new Intent(context, LocationService.class));
- }
- };
- }
-
- /**
- * broadcasts location to anything listening for updates,
- * since this is the last function of the service, we call finish()u
- * @author ricky barrette
- */
- private void broadcastLocation() {
- Log.v(TravelPost.TAG, "broadcastLocation()");
- if (mLocation != null) {
- Intent locationUpdate = new Intent();
- locationUpdate.setAction(LocationReceiver.ACTION_UPDATE);
- locationUpdate.putExtra(LocationReceiver.LOCATION_PARCEL, mLocation);
- sendBroadcast(locationUpdate);
- }
- }
-
- /**
- * (non-Javadoc)
- * @see android.app.Service#onBind(android.content.Intent)
- * @param arg0
- * @return
- * @author ricky barrette
- */
- @Override
- public IBinder onBind(Intent arg0) {
- // UNUSED
- return null;
- }
-
- /**
- * called when the service is created. this will initialize the location manager, and acquire a wakelock
- * (non-Javadoc)
- * @see android.app.Service#onCreate()
- * @author ricky barrette
- */
- @Override
- public void onCreate(){
- Log.v(TravelPost.TAG, "onCreate()");
- mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
- mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
- PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TravelPost.TAG);
- mWakeLock.acquire();
-
- //display notification
- PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, TravelPost.class), android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
- mNotification = new Notification(R.drawable.icon, "Getting Location", System.currentTimeMillis());
- mNotification.flags |= Notification.FLAG_ONGOING_EVENT;
- mNotification.setLatestEventInfo(this, "Travel Post", "Gathering location...", intent);
- mNotificationManager.notify(SIMPLE_NOTFICATION_ID, mNotification);
-
- /*
- * que the fail safe runnable to kill the report location and kill it self after the MAX_RUN_TIME has been meet
- */
- new Handler().postDelayed(mFailSafe, MAX_RUN_TIME);
- }
-
- /**
- * called when the service is destroyed.
- * this will remove any wakelock or location service running, and register to be waken back up
- * (non-Javadoc)
- * @see android.app.Service#onDestroy()
- * @author ricky barrette
- */
- @Override
- public void onDestroy(){
- broadcastLocation();
- mLocationManager.removeUpdates(this);
- mNotificationManager.cancel(SIMPLE_NOTFICATION_ID);
- if(mWakeLock.isHeld())
- mWakeLock.release();
- }
-
- /**
- * (non-Javadoc)
- * @see android.location.LocationListener#onLocationChanged(android.location.Location)
- * @param location
- * @author ricky barrette
- */
- @Override
- public void onLocationChanged(Location location) {
-// Log.d(TAG, "got location +- "+ location.getAccuracy() +"m");
- mLocation = location;
- if(location.getAccuracy() <= DESIRED_ACCURACY){
- stopSelf(mStartId);
- }
- }
-
- /**
- * (non-Javadoc)
- * @see android.location.LocationListener#onProviderDisabled(java.lang.String)
- * @param arg0
- * @author ricky barrette
- */
- @Override
- public void onProviderDisabled(String arg0) {
- // UNUSED
- }
-
- /**
- * (non-Javadoc)
- * @see android.location.LocationListener#onProviderEnabled(java.lang.String)
- * @param arg0
- * @author ricky barrette
- */
- @Override
- public void onProviderEnabled(String arg0) {
- // UNUSED
- }
-
- /**
- * To keep backwards compatibility we override onStart which is the equivalent of onStartCommand in pre android 2.x
- * @author ricky barrette
- */
- @Override
- public void onStart(Intent intent, int startId) {
- Log.i(TravelPost.TAG, "onStart.Service started with start id of: " + startId);
- mStartId = startId;
- startLocationService();
- }
-
- /**
- * This method is called when startService is called. only used in 2.x android.
- * @author ricky barrette
- */
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- Log.i(TravelPost.TAG , "onStartCommand.Service started with start id of: " + startId);
- mStartId = startId;
- startLocationService();
- return START_STICKY;
- }
-
-
- /**
- * (non-Javadoc)
- * @see android.location.LocationListener#onStatusChanged(java.lang.String, int, android.os.Bundle)
- * @author ricky barrette
- */
- @Override
- public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
- // UNUSED
- }
-
- /**
- * request periodic location updates from androids location services
- * @author ricky barrette
- */
- private void startLocationService() {
- mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
- mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
- mLocationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, 0, 0, this);
- }
-
-}
\ No newline at end of file
diff --git a/TravelPost/src/com/TwentyCodes/android/TravelPost/ReverseGeocode.java b/TravelPost/src/com/TwentyCodes/android/TravelPost/ReverseGeocode.java
deleted file mode 100644
index efe4687..0000000
--- a/TravelPost/src/com/TwentyCodes/android/TravelPost/ReverseGeocode.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
-Apparently geocoder is not working with the Emulated android. This is a workaround.
-
-Here is how I implemented it:
-
-try {
- possibleAddresses = g.getFromLocation(location.getLatitude(), location.getLongitude(), 3);
-} catch (IOException e) {
- if("sdk".equals( Build.PRODUCT )) {
- Log.d(TAG, "Geocoder doesn't work under emulation.");
- possibleAddresses = ReverseGeocode.getFromLocation(location.getLatitude(), location.getLongitude(), 3);
- } else
- e.printStackTrace();
-}
-
-*/
-
-package com.TwentyCodes.android.TravelPost;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.location.Address;
-import android.location.Location;
-import android.util.Log;
-
-/**
- * Due to this bug http://code.google.com/p/android/issues/detail?id=8816 google's Geocoder class does not function.
- * I found this source in one of the comments mentioning that it is a work around
- *
- * @author ricky barrette
- */
-public class ReverseGeocode {
-
- public static List