Java Code Examples for com.facebook.share.Sharer#Result
The following examples show how to use
com.facebook.share.Sharer#Result .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShareInternalUtility.java From kognitivo with Apache License 2.0 | 6 votes |
public static void registerSharerCallback( final int requestCode, final CallbackManager callbackManager, final FacebookCallback<Sharer.Result> callback) { if (!(callbackManager instanceof CallbackManagerImpl)) { throw new FacebookException("Unexpected CallbackManager, " + "please use the provided Factory."); } ((CallbackManagerImpl) callbackManager).registerCallback( requestCode, new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return handleActivityResult( requestCode, resultCode, data, getShareResultProcessor(callback)); } }); }
Example 2
Source File: VideoUploader.java From kognitivo with Apache License 2.0 | 6 votes |
public static synchronized void uploadAsync( ShareVideoContent videoContent, String graphNode, FacebookCallback<Sharer.Result> callback) throws FileNotFoundException { if (!initialized) { registerAccessTokenTracker(); initialized = true; } Validate.notNull(videoContent, "videoContent"); Validate.notNull(graphNode, "graphNode"); ShareVideo video = videoContent.getVideo(); Validate.notNull(video, "videoContent.video"); Uri videoUri = video.getLocalUrl(); Validate.notNull(videoUri, "videoContent.video.localUrl"); UploadContext uploadContext = new UploadContext(videoContent, graphNode, callback); uploadContext.initialize(); pendingUploads.add(uploadContext); enqueueUploadStart( uploadContext, 0); }
Example 3
Source File: VideoUploader.java From kognitivo with Apache License 2.0 | 6 votes |
private UploadContext( ShareVideoContent videoContent, String graphNode, FacebookCallback<Sharer.Result> callback) { // Store off the access token right away so that under no circumstances will we // end up with different tokens between phases. We will rely on the access token tracker // to cancel pending uploads. this.accessToken = AccessToken.getCurrentAccessToken(); this.videoUri = videoContent.getVideo().getLocalUrl(); this.title = videoContent.getContentTitle(); this.description = videoContent.getContentDescription(); this.ref = videoContent.getRef(); this.graphNode = graphNode; this.callback = callback; this.params = videoContent.getVideo().getParameters(); }
Example 4
Source File: ShareInternalUtility.java From kognitivo with Apache License 2.0 | 5 votes |
public static void invokeCallbackWithException( FacebookCallback<Sharer.Result> callback, final Exception exception) { if (exception instanceof FacebookException) { invokeOnErrorCallback(callback, (FacebookException) exception); return; } invokeCallbackWithError( callback, "Error preparing share content: " + exception.getLocalizedMessage()); }
Example 5
Source File: ShareInternalUtility.java From kognitivo with Apache License 2.0 | 5 votes |
public static void invokeCallbackWithResults( FacebookCallback<Sharer.Result> callback, final String postId, final GraphResponse graphResponse) { FacebookRequestError requestError = graphResponse.getError(); if (requestError != null) { String errorMessage = requestError.getErrorMessage(); if (Utility.isNullOrEmpty(errorMessage)) { errorMessage = "Unexpected error sharing."; } invokeOnErrorCallback(callback, graphResponse, errorMessage); } else { invokeOnSuccessCallback(callback, postId); } }
Example 6
Source File: SendButton.java From kognitivo with Apache License 2.0 | 5 votes |
@Override protected FacebookDialogBase<ShareContent, Sharer.Result> getDialog() { final MessageDialog dialog; if (SendButton.this.getFragment() != null) { dialog = new MessageDialog(SendButton.this.getFragment() , getRequestCode()); } else { dialog = new MessageDialog(getActivity(), getRequestCode()); } return dialog; }
Example 7
Source File: ShareInternalUtility.java From kognitivo with Apache License 2.0 | 5 votes |
static void invokeOnSuccessCallback( FacebookCallback<Sharer.Result> callback, String postId) { logShareResult(AnalyticsEvents.PARAMETER_SHARE_OUTCOME_SUCCEEDED, null); if (callback != null) { callback.onSuccess(new Sharer.Result(postId)); } }
Example 8
Source File: ShareInternalUtility.java From kognitivo with Apache License 2.0 | 5 votes |
static void invokeOnErrorCallback( FacebookCallback<Sharer.Result> callback, GraphResponse response, String message) { logShareResult(AnalyticsEvents.PARAMETER_SHARE_OUTCOME_ERROR, message); if (callback != null) { callback.onError(new FacebookGraphResponseException(response, message)); } }
Example 9
Source File: ShareInternalUtility.java From kognitivo with Apache License 2.0 | 5 votes |
static void invokeOnErrorCallback( FacebookCallback<Sharer.Result> callback, String message) { logShareResult(AnalyticsEvents.PARAMETER_SHARE_OUTCOME_ERROR, message); if (callback != null) { callback.onError(new FacebookException(message)); } }
Example 10
Source File: ShareInternalUtility.java From kognitivo with Apache License 2.0 | 5 votes |
static void invokeOnErrorCallback( FacebookCallback<Sharer.Result> callback, FacebookException ex) { logShareResult(AnalyticsEvents.PARAMETER_SHARE_OUTCOME_ERROR, ex.getMessage()); if (callback != null) { callback.onError(ex); } }
Example 11
Source File: ShareButton.java From kognitivo with Apache License 2.0 | 5 votes |
@Override protected FacebookDialogBase<ShareContent, Sharer.Result> getDialog() { final ShareDialog dialog; if (ShareButton.this.getFragment() != null) { dialog = new ShareDialog(ShareButton.this.getFragment() , getRequestCode()); } else { dialog = new ShareDialog(getActivity(), getRequestCode()); } return dialog; }
Example 12
Source File: ShareInternalUtility.java From kognitivo with Apache License 2.0 | 4 votes |
public static void invokeCallbackWithError( FacebookCallback<Sharer.Result> callback, String error) { invokeOnErrorCallback(callback, error); }
Example 13
Source File: VideoUploader.java From kognitivo with Apache License 2.0 | 4 votes |
public static synchronized void uploadAsync( ShareVideoContent videoContent, FacebookCallback<Sharer.Result> callback) throws FileNotFoundException { uploadAsync(videoContent, "me", callback); }
Example 14
Source File: ShareInternalUtility.java From kognitivo with Apache License 2.0 | 4 votes |
static void invokeOnCancelCallback(FacebookCallback<Sharer.Result> callback) { logShareResult(AnalyticsEvents.PARAMETER_SHARE_OUTCOME_CANCELLED, null); if (callback != null) { callback.onCancel(); } }
Example 15
Source File: ShareButtonBase.java From kognitivo with Apache License 2.0 | 3 votes |
/** * Allows registration of a callback for when the share completes. This should be called * in the {@link android.app.Activity#onCreate(android.os.Bundle)} or * {@link android.support.v4.app.Fragment#onCreate(android.os.Bundle)} methods. * * @param callbackManager The {@link com.facebook.CallbackManager} instance that will be * handling results that are received via * {@link android.app.Activity#onActivityResult(int, int, android.content.Intent)} * @param callback The callback that should be called to handle dialog completion. * @param requestCode The request code to use, this should be outside of the range of those * reserved for the Facebook SDK * {@link com.facebook.FacebookSdk#isFacebookRequestCode(int)}. */ public void registerCallback( final CallbackManager callbackManager, final FacebookCallback<Sharer.Result> callback, final int requestCode) { setRequestCode(requestCode); registerCallback(callbackManager, callback); }
Example 16
Source File: ShareButtonBase.java From kognitivo with Apache License 2.0 | 2 votes |
/** * Allows registration of a callback for when the share completes. This should be called * in the {@link android.app.Activity#onCreate(android.os.Bundle)} or * {@link android.support.v4.app.Fragment#onCreate(android.os.Bundle)} methods. * * @param callbackManager The {@link com.facebook.CallbackManager} instance that will be * handling results that are received via * {@link android.app.Activity#onActivityResult(int, int, android.content.Intent)} * @param callback The callback that should be called to handle dialog completion. */ public void registerCallback( final CallbackManager callbackManager, final FacebookCallback<Sharer.Result> callback) { ShareInternalUtility.registerSharerCallback(getRequestCode(), callbackManager, callback); }
Example 17
Source File: ShareButtonBase.java From kognitivo with Apache License 2.0 | votes |
abstract protected FacebookDialogBase<ShareContent, Sharer.Result> getDialog();
Example 18
Source File: FacebookHelper.java From AndroidBlueprints with Apache License 2.0 | votes |
void onFacebookShareSuccess(Sharer.Result result);