use of com.facebook.Session in project openkit-android by OpenKit.
the class SessionTracker method stopTracking.
/**
* Stop tracking the Session and remove any callbacks attached
* to those sessions.
*/
public void stopTracking() {
if (!isTracking) {
return;
}
Session session = getSession();
if (session != null) {
session.removeCallback(callback);
}
broadcastManager.unregisterReceiver(receiver);
isTracking = false;
}
use of com.facebook.Session in project Klyph by jonathangerbaud.
the class ImageFragment method handleLikeCommentAction.
private void handleLikeCommentAction(final Comment comment) {
pendingLikeComment = false;
pendingCommentLike = comment;
Session session = Session.getActiveSession();
List<String> permissions = session.getPermissions();
if (!permissions.containsAll(PERMISSIONS)) {
pendingLikeComment = true;
requestPublishPermissions(session);
return;
}
doLikeCommentAction(comment);
pendingLikeComment = false;
}
use of com.facebook.Session in project Klyph by jonathangerbaud.
the class PostPhotosActivity method handlePublishPost.
private void handlePublishPost() {
pendingAnnounce = false;
Session session = Session.getActiveSession();
List<String> permissions = session.getPermissions();
if (!permissions.containsAll(PERMISSIONS)) {
pendingAnnounce = true;
requestPublishPermissions(this, PERMISSIONS);
return;
}
publishPhotos();
}
use of com.facebook.Session in project Klyph by jonathangerbaud.
the class PreferencesActivity method handleSetNotifications.
private void handleSetNotifications() {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = sharedPreferences.edit();
@SuppressWarnings("deprecation") CheckBoxPreference cpref = (CheckBoxPreference) findPreference("preference_notifications");
pendingAnnounce = false;
final Session session = Session.getActiveSession();
List<String> permissions = session.getPermissions();
if (!permissions.containsAll(PERMISSIONS)) {
pendingAnnounce = true;
editor.putBoolean(KlyphPreferences.PREFERENCE_NOTIFICATIONS, false);
editor.commit();
cpref.setChecked(false);
AlertUtil.showAlert(this, R.string.preferences_notifications_permissions_title, R.string.preferences_notifications_permissions_message, R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
requestPublishPermissions(session);
}
}, R.string.cancel, null);
return;
}
editor.putBoolean(KlyphPreferences.PREFERENCE_NOTIFICATIONS, true);
editor.commit();
cpref.setChecked(true);
startOrStopNotificationsServices();
if (sharedPreferences.getBoolean(KlyphPreferences.PREFERENCE_NOTIFICATIONS_BIRTHDAY, false) == true)
KlyphService.startBirthdayService();
}
use of com.facebook.Session in project Klyph by jonathangerbaud.
the class FacebookFragment method openSession.
private void openSession(String applicationId, List<String> permissions, SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
if (sessionTracker != null) {
Session currentSession = sessionTracker.getSession();
if (currentSession == null || currentSession.getState().isClosed()) {
Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
Session.setActiveSession(session);
currentSession = session;
}
if (!currentSession.isOpened()) {
Session.OpenRequest openRequest = new Session.OpenRequest(this).setPermissions(permissions).setLoginBehavior(behavior).setRequestCode(activityCode);
if (SessionAuthorizationType.PUBLISH.equals(authType)) {
currentSession.openForPublish(openRequest);
} else {
currentSession.openForRead(openRequest);
}
}
}
}
Aggregations