From 894efa804bc097a5e4ae770a107def80d6eeb42e Mon Sep 17 00:00:00 2001 From: ricky barrette Date: Sat, 12 Feb 2011 18:23:14 +0000 Subject: [PATCH] i added a shared_prefs check in LocationReceiver.java that checks to see if facebook has been authorized by checking for the saved access_token. from my test this has fixed the chrashing issue i metioned before. --- .../android/TravelPost/LocationReceiver.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationReceiver.java b/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationReceiver.java index 9ed5216..4db6cc5 100644 --- a/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationReceiver.java +++ b/TravelPost/src/com/TwentyCodes/android/TravelPost/LocationReceiver.java @@ -88,17 +88,17 @@ public class LocationReceiver extends BroadcastReceiver{ e.printStackTrace(); } - //post to facebook - FacebookAuth fbAuth = new FacebookAuth(mContext, new Activity()); - fbAuth.authorize(); - if(fbAuth.isSessionValid()) + //if there is a facebook authization, then post! + if (mContext.getSharedPreferences("facebook-session.xml", 0).getString("access_token", null) != null) { + //post to facebook + FacebookAuth fbAuth = new FacebookAuth(mContext, new Activity()); + fbAuth.authorize(); try { fbAuth.postToWall(thePost); } catch (SessionNotValidException e) { e.printStackTrace(); } - else - Log.d(TravelPost.TAG, "cant post to FB, not auth'd"); + } }