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.
This commit is contained in:
@@ -88,17 +88,17 @@ public class LocationReceiver extends BroadcastReceiver{
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//post to facebook
|
//if there is a facebook authization, then post!
|
||||||
FacebookAuth fbAuth = new FacebookAuth(mContext, new Activity());
|
if (mContext.getSharedPreferences("facebook-session.xml", 0).getString("access_token", null) != null) {
|
||||||
fbAuth.authorize();
|
//post to facebook
|
||||||
if(fbAuth.isSessionValid())
|
FacebookAuth fbAuth = new FacebookAuth(mContext, new Activity());
|
||||||
|
fbAuth.authorize();
|
||||||
try {
|
try {
|
||||||
fbAuth.postToWall(thePost);
|
fbAuth.postToWall(thePost);
|
||||||
} catch (SessionNotValidException e) {
|
} catch (SessionNotValidException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
Log.d(TravelPost.TAG, "cant post to FB, not auth'd");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user