在本文中,我们将带你了解FacebookMarketingAPI-广告计费交易在这篇文章中,我们将为您详细介绍FacebookMarketingAPI-广告计费交易的方方面面,并解答facebook广
在本文中,我们将带你了解Facebook Marketing API - 广告计费交易在这篇文章中,我们将为您详细介绍Facebook Marketing API - 广告计费交易的方方面面,并解答facebook广告如何计算费用常见的疑惑,同时我们还将给您一些技巧,以帮助您实现更有效的android – Facebook Pixel Conversion(Facebook广告)未在Ionic框架中更新、com.facebook.FacebookException的实例源码、com.facebook.FacebookGraphObjectException的实例源码、com.facebook.FacebookGraphResponseException的实例源码。
本文目录一览:- Facebook Marketing API - 广告计费交易(facebook广告如何计算费用)
- android – Facebook Pixel Conversion(Facebook广告)未在Ionic框架中更新
- com.facebook.FacebookException的实例源码
- com.facebook.FacebookGraphObjectException的实例源码
- com.facebook.FacebookGraphResponseException的实例源码
Facebook Marketing API - 广告计费交易(facebook广告如何计算费用)
不幸的是,该端点不是公共 API 的一部分。正式地,它只能通过广告管理器访问。虽然访问私有 API 肯定是可能的,但它也是冒帐户被暂停风险的好方法。
android – Facebook Pixel Conversion(Facebook广告)未在Ionic框架中更新
对FB像素(FB广告)有疑问.
事情是我想做跟踪,看看用户是否注册APP.
所以我在< head>< / head>之间实现了跟踪代码.在index.html中标记,并注释掉< img> tag和fbq(‘track’,“CompleteRegistration”);
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', 'FB-TRACKING-CODE');//change pixel id
</script>
<!-- <noscript> -->
<!-- <img height="1" width="1"https://www.jb51.cc/tag/dis/" target="_blank">display:none" src="https://www.facebook.com/tr?id=FB-TRACKING-CODE&ev=PageView&noscript=1"/> -->
<!-- </noscript> -->
然后我实现了fbq(‘track’,“CompleteRegistration”);在控制器中,像这样
$scope.register = function(userData, isValid) {
window.fbq('track', "CompleteRegistration");}
因此,当用户单击注册按钮时,它还将更新FB Ads中的数据.
它应该像预期的那样简单……但事情并不顺利,现在我遇到的问题是它不会更新FB Ads中的数据.所以问题是为什么不更新?哪一部分我做错了?
不适用于iOS和Android.
感谢大家.
解决方法:
我担心使用facebook像素是不可能的. Facebook像素将注册转化,但Facebook无法将这些转化链接到看到您广告的用户,因为离子使用的是在Facebook用户未登录的网页浏览.
com.facebook.FacebookException的实例源码
private static void validate(ShareContent content,Validator validator) throws FacebookException { if (content == null) { throw new FacebookException("Must provide non-null content to share"); } if (content instanceof ShareLinkContent) { validator.validate((ShareLinkContent) content); } else if (content instanceof SharePhotoContent) { validator.validate((SharePhotoContent) content); } else if (content instanceof ShareVideoContent) { validator.validate((ShareVideoContent) content); } else if (content instanceof ShareOpenGraphContent) { validator.validate((ShareOpenGraphContent) content); } }
private static void validatePhotoContent( SharePhotoContent photoContent,Validator validator) { List<SharePhoto> photos = photoContent.getPhotos(); if (photos == null || photos.isEmpty()) { throw new FacebookException("Must specify at least one Photo in SharePhotoContent."); } if (photos.size() > ShareConstants.MAXIMUM_PHOTO_COUNT) { throw new FacebookException( String.format( Locale.ROOT,"Cannot add more than %d photos.",ShareConstants.MAXIMUM_PHOTO_COUNT)); } for (SharePhoto photo : photos) { validator.validate(photo); } }
private static void validatePhotoForApi(SharePhoto photo,Validator validator) { if (photo == null) { throw new FacebookException("Cannot share a null SharePhoto"); } Bitmap photoBitmap = photo.getBitmap(); Uri photoUri = photo.getimageUrl(); if (photoBitmap == null) { if (photoUri == null) { throw new FacebookException( "SharePhoto does not have a Bitmap or ImageUrl specified"); } if (Utility.isWebUri(photoUri) && !validator.isOpenGraphContent()) { throw new FacebookException( "Cannot set the ImageUrl of a SharePhoto to the Uri of an image on the " + "web when sharing SharePhotoContent"); } } }
private static void validateOpenGraphContent( ShareOpenGraphContent openGraphContent,Validator validator) { validator.validate(openGraphContent.getAction()); String previewPropertyName = openGraphContent.getPreviewPropertyName(); if (Utility.isNullOrEmpty(previewPropertyName)) { throw new FacebookException("Must specify a previewPropertyName."); } if (openGraphContent.getAction().get(previewPropertyName) == null) { throw new FacebookException( "Property \"" + previewPropertyName + "\" was not found on the action. " + "The name of the preview property must match the name of an " + "action property."); } }
public static FacebookException getExceptionFromErrorData(Bundle errorData) { if (errorData == null) { return null; } String type = errorData.getString(BRIDGE_ARG_ERROR_TYPE); if (type == null) { type = errorData.getString(STATUS_ERROR_TYPE); } String description = errorData.getString(BRIDGE_ARG_ERROR_DESCRIPTION); if (description == null) { description = errorData.getString(STATUS_ERROR_DESCRIPTION); } if (type == null || !type.equalsIgnoreCase(ERROR_USER_CANCELED)) { return new FacebookException(description); } return new FacebookOperationCanceledException(description); }
void initializefacebookLogin() { // Initialize Facebook Login button mCallbackManager = CallbackManager.Factory.create(); LoginButton loginButton = (LoginButton) findViewById(R.id.button_facebook_login); loginButton.setReadPermissions("email","public_profile","user_posts","user_photos"); loginButton.registerCallback(mCallbackManager,new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Log.d(TAG,"facebook:onSuccess:" + loginResult); handleFacebookAccesstoken(loginResult.getAccesstoken()); } @Override public void onCancel() { Log.d(TAG,"facebook:onCancel"); // ... } @Override public void onError(FacebookException error) { Log.w(TAG,"facebook:onError",error); } }); }
private static void validateOpenGraphValueContainer( ShareOpenGraphValueContainer valueContainer,Validator validator,boolean requireNamespace) { Set<String> keySet = valueContainer.keySet(); for (String key : keySet) { validateOpenGraphKey(key,requireNamespace); Object o = valueContainer.get(key); if (o instanceof List) { List list = (List) o; for (Object objectInList : list) { if (objectInList == null) { throw new FacebookException( "Cannot put null objects in Lists in " + "ShareOpenGraphObjects and ShareOpenGraphActions"); } validateOpenGraphValueContainerObject(objectInList,validator); } } else { validateOpenGraphValueContainerObject(o,validator); } } }
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)); } }); }
public static JSONObject toJSONObjectForWeb( final ShareOpenGraphContent shareOpenGraphContent) throws JSONException { ShareOpenGraphAction action = shareOpenGraphContent.getAction(); return OpenGraphJSONUtility.toJSONObject( action,new OpenGraphJSONUtility.PhotoJSONProcessor() { @Override public JSONObject toJSONObject(SharePhoto photo) { Uri photoUri = photo.getimageUrl(); JSONObject photoJSONObject = new JSONObject(); try { photoJSONObject.put( NativeProtocol.IMAGE_URL_KEY,photoUri.toString()); } catch (JSONException e) { throw new FacebookException("Unable to attach images",e); } return photoJSONObject; } }); }
private static void issueResponse( final UploadContext uploadContext,final FacebookException error,final String videoId) { // Remove the UploadContext synchronously // Once the UploadContext is removed,this is the only reference to it. removePendingUpload(uploadContext); Utility.closeQuietly(uploadContext.videoStream); if (uploadContext.callback != null) { if (error != null) { ShareInternalUtility.invokeOnErrorCallback(uploadContext.callback,error); } else if (uploadContext.isCanceled) { ShareInternalUtility.invokeOnCancelCallback(uploadContext.callback); } else { ShareInternalUtility.invokeOnSuccessCallback(uploadContext.callback,videoId); } } }
private void initialize() throws FileNotFoundException { ParcelFileDescriptor fileDescriptor = null; try { if (Utility.isFileUri(videoUri)) { fileDescriptor = ParcelFileDescriptor.open( new File(videoUri.getPath()),ParcelFileDescriptor.MODE_READ_ONLY); videoSize = fileDescriptor.getStatSize(); videoStream = new ParcelFileDescriptor.AutoCloseInputStream(fileDescriptor); } else if (Utility.isContentUri(videoUri)) { videoSize = Utility.getContentSize(videoUri); videoStream = FacebookSdk .getApplicationContext() .getContentResolver() .openInputStream(videoUri); } else { throw new FacebookException("Uri must be a content:// or file:// uri"); } } catch (FileNotFoundException e) { Utility.closeQuietly(videoStream); throw e; } }
@Override public Bundle getParameters() throws IOException { Bundle parameters = new Bundle(); parameters.putString(ParaM_UPLOAD_PHASE,ParaM_VALUE_UPLOAD_TRANSFER_PHASE); parameters.putString(ParaM_SESSION_ID,uploadContext.sessionId); parameters.putString(ParaM_START_OFFSET,chunkStart); byte[] chunk = getChunk(uploadContext,chunkStart,chunkEnd); if (chunk != null) { parameters.putByteArray(ParaM_VIDEO_FILE_CHUNK,chunk); } else { throw new FacebookException("Error reading video"); } return parameters; }
/** * Register call back manager to Google log in button. * * @param activity the activity * @param loginButton the login button */ private void registerCallBackManager(final Activity activity,LoginButton loginButton) { loginButton.registerCallback(mCallbackManager,new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { mLoginResult = loginResult; getUserProfile(activity); } @Override public void onCancel() { mFacebookLoginResultCallBack.onFacebookLoginCancel(); } @Override public void onError(FacebookException error) { mFacebookLoginResultCallBack.onFacebookLoginError(error); } }); }
public LoginFacebook(LoginButton login,Activity context,PreferencesShared pref,final Intent intent) { callbackManager = CallbackManager.Factory.create(); this.context = context; preferencesShared = pref; login.setReadPermissions(Arrays.asList("public_profile","user_friends")); login.registerCallback(callbackManager,new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { //Log.d("facebook","succes" + loginResult.getAccesstoken().getToken() + "id" + loginResult.getAccesstoken().getExpires() + "data" + loginResult.getAccesstoken().getUserId()); conectedwithFacebook(loginResult.getAccesstoken().getToken(),intent); } @Override public void onCancel() { Log.d("intra","facebook"); } @Override public void onError(FacebookException error) { Log.d("facebook","error" + error.toString()); } }); }
void authorize(Request request) { if (request == null) { return; } if (pendingRequest != null) { throw new FacebookException("Attempted to authorize while a request is pending."); } if (Accesstoken.getCurrentAccesstoken() != null && !checkInternetPermission()) { // We're going to need INTERNET permission later and don't have it,so fail early. return; } pendingRequest = request; handlersToTry = getHandlersToTry(request); tryNextHandler(); }
private void processResponse(ImageResponse response) { // First check if the response is for the right request. We may have: // 1. Sent a new request,thus super-ceding this one. // 2. Detached this view,in which case the response should be discarded. if (response.getRequest() == lastRequest) { lastRequest = null; Bitmap responseImage = response.getBitmap(); Exception error = response.getError(); if (error != null) { OnErrorListener listener = onErrorListener; if (listener != null) { listener.onError(new FacebookException( "Error in downloading profile picture for profileId: " + getProfileId(),error)); } else { Logger.log(LoggingBehavior.REQUESTS,Log.ERROR,TAG,error.toString()); } } else if (responseImage != null) { setimageBitmap(responseImage); if (response.isCachedRedirect()) { sendImageRequest(false); } } } }
@Override public void setCallbackToLoginFacebookButton() { callbackManager = CallbackManager.Factory.create(); LoginManager.getInstance().registerCallback(callbackManager,new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Bundle param = new Bundle(); param.putString("fields","id,email"); facebookLink(loginResult); } @Override public void onCancel() { } @Override public void onError(FacebookException error) { Logger.logExceptionToFabric(error); } }); }
public static FacebookException getExceptionFromErrorData(Bundle errorData) { if (errorData == null) { return null; } String type = errorData.getString(BRIDGE_ARG_ERROR_TYPE); if (type == null) { type = errorData.getString(STATUS_ERROR_TYPE); } String description = errorData.getString(BRIDGE_ARG_ERROR_DESCRIPTION); if (description == null) { description = errorData.getString(STATUS_ERROR_DESCRIPTION); } if (type != null && type.equalsIgnoreCase(ERROR_USER_CANCELED)) { return new FacebookOperationCanceledException(description); } /* Todo parse error values and create appropriate exception class */ return new FacebookException(description); }
private void processResponse(ImageResponse response) { // First check if the response is for the right request. We may have: // 1. Sent a new request,in which case the response should be discarded. if (response.getRequest() == lastRequest) { lastRequest = null; Bitmap responseImage = response.getBitmap(); Exception error = response.getError(); if (error != null) { OnErrorListener listener = onErrorListener; if (listener != null) { listener.onError(new FacebookException( "Error in downloading profile picture for profileId: " + getProfileId(),error.toString()); } } else if (responseImage != null) { setimageBitmap(responseImage); if (response.isCachedRedirect()) { sendImageRequest(false); } } } }
public FacebookHelper(@NonNull FacebookListener facebookListener) { mListener = facebookListener; mCallBackManager = CallbackManager.Factory.create(); FacebookCallback<LoginResult> mCallBack = new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { mListener.onFbSignInSuccess(loginResult.getAccesstoken().getToken(),loginResult.getAccesstoken().getUserId()); } @Override public void onCancel() { mListener.onFbSignInFail("User cancelled operation"); } @Override public void onError(FacebookException e) { mListener.onFbSignInFail(e.getMessage()); } }; LoginManager.getInstance().registerCallback(mCallBackManager,mCallBack); }
@OnClick(R.id.fb_login) public void setUpFacebookLoginButton() { LoginManager.getInstance().logInWithReadPermissions(this,Arrays.asList("email","public_profile")); LoginManager.getInstance().registerCallback(callbackManager,new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { handleFacebookAccesstoken(loginResult.getAccesstoken()); } @Override public void onCancel() { } @Override public void onError(FacebookException error) { if(!isNetworkConnected()){ Snackbar.make(findViewById(android.R.id.content),"please check internet connection",Snackbar.LENGTH_SHORT).show(); }else{ Snackbar.make(findViewById(android.R.id.content),"unexpected error,please try again later",Snackbar.LENGTH_SHORT).show(); } } }); }
protected void registerFacebookCallback() { LoginManager.getInstance().registerCallback(facebookCallbackManager,new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { // App code Log.d(TAG,"Login Success"); handleFacebookAccesstoken(loginResult.getAccesstoken()); } @Override public void onCancel() { // App code Log.d(TAG,"Login canceled"); } @Override public void onError(FacebookException exception) { // App code Log.d(TAG,"Login error"); } }); }
private void processResponse(ImageResponse response) { // First check if the response is for the right request. We may have: // 1. Sent a new request,error.toString()); } } else if (responseImage != null) { setimageBitmap(responseImage); if (response.isCachedRedirect()) { sendImageRequest(false); } } } }
private void facebookLogIn(View view) { LoginButton loginButton = (LoginButton) view.findViewById(R.id.login_button); loginButton.setReadPermissions("email"); // If using in a fragment loginButton.setFragment(this); // Other app specific specialization loginButton.performClick(); // Callback registration loginButton.registerCallback(callbackManager,new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { // App code Toast.makeText(getContext(),"Logged In Successfully",Toast.LENGTH_SHORT).show(); setSessionManagement(); startActivity(new Intent(getApplicationContext(),MapsActivity.class)); } @Override public void onCancel() { // App code Toast.makeText(getContext(),"LogIn Failed",Toast.LENGTH_SHORT).show(); } @Override public void onError(FacebookException exception) { // App code Toast.makeText(getContext(),Toast.LENGTH_SHORT).show(); } }); }
public static Bundle create( UUID callId,ShareContent shareContent,boolean shouldFailOnDataError) { Validate.notNull(shareContent,"shareContent"); Validate.notNull(callId,"callId"); Bundle nativeParams = null; if (shareContent instanceof ShareLinkContent) { final ShareLinkContent linkContent = (ShareLinkContent) shareContent; nativeParams = create(linkContent,shouldFailOnDataError); } else if (shareContent instanceof SharePhotoContent) { final SharePhotoContent photoContent = (SharePhotoContent) shareContent; List<String> photoUrls = ShareInternalUtility.getPhotoUrls( photoContent,callId); nativeParams = create(photoContent,photoUrls,shouldFailOnDataError); } else if (shareContent instanceof ShareVideoContent) { final ShareVideoContent videoContent = (ShareVideoContent) shareContent; String videoUrl = ShareInternalUtility.getVideoUrl(videoContent,callId); nativeParams = create(videoContent,videoUrl,shouldFailOnDataError); } else if (shareContent instanceof ShareOpenGraphContent) { final ShareOpenGraphContent openGraphContent = (ShareOpenGraphContent) shareContent; try { JSONObject openGraphActionjsON = ShareInternalUtility.toJSONObjectForCall( callId,openGraphContent); openGraphActionjsON = ShareInternalUtility.removeNamespacesFromogJsonObject( openGraphActionjsON,false); nativeParams = create(openGraphContent,openGraphActionjsON,shouldFailOnDataError); } catch (final JSONException e) { throw new FacebookException( "Unable to create a JSON Object from the provided ShareOpenGraphContent: " + e.getMessage()); } } return nativeParams; }
private static void validateLinkContent( ShareLinkContent linkContent,Validator validator) { Uri imageUrl = linkContent.getimageUrl(); if (imageUrl != null && !Utility.isWebUri(imageUrl)) { throw new FacebookException("Image Url must be an http:// or https:// url"); } }
private static void validatePhotoForWebDialog(SharePhoto photo,Validator validator) { if (photo == null) { throw new FacebookException("Cannot share a null SharePhoto"); } Uri imageUri = photo.getimageUrl(); if (imageUri == null || !Utility.isWebUri(imageUri)) { throw new FacebookException( "SharePhoto must have a non-null imageUrl set to the Uri of an image " + "on the web"); } }
private static void validateVideo(ShareVideo video,Validator validator) { if (video == null) { throw new FacebookException("Cannot share a null ShareVideo"); } Uri localUri = video.getLocalUrl(); if (localUri == null) { throw new FacebookException("ShareVideo does not have a LocalUrl specified"); } if (!Utility.isContentUri(localUri) && !Utility.isFileUri(localUri)) { throw new FacebookException("ShareVideo must reference a video that is on the device"); } }
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()); }
public static boolean handleActivityResult( int requestCode,int resultCode,Intent data,ResultProcessor resultProcessor) { AppCall appCall = getAppCallFromActivityResult(requestCode,data); if (appCall == null) { return false; } NativeAppCallAttachmentStore.cleanupAttachmentsForCall(appCall.getCallId()); if (resultProcessor == null) { return true; } FacebookException exception = NativeProtocol.getExceptionFromErrorData( NativeProtocol.getErrorDataFromresultIntent(data)); if (exception != null) { if (exception instanceof FacebookOperationCanceledException) { resultProcessor.onCancel(appCall); } else { resultProcessor.onError(appCall,exception); } } else { // If here,we did not find an error in the result. Bundle results = NativeProtocol.getSuccessResultsFromIntent(data); resultProcessor.onSuccess(appCall,results); } return true; }
static void invokeOnErrorCallback( FacebookCallback<Sharer.Result> callback,String message) { logShareResult(AnalyticsEvents.ParaMETER_SHARE_OUTCOME_ERROR,message); if (callback != null) { callback.onError(new FacebookException(message)); } }
static void invokeOnErrorCallback( FacebookCallback<Sharer.Result> callback,FacebookException ex) { logShareResult(AnalyticsEvents.ParaMETER_SHARE_OUTCOME_ERROR,ex.getMessage()); if (callback != null) { callback.onError(ex); } }
/** * Creates a new Request configured to upload an image to create a staging resource. Staging * resources allow you to post binary data such as images,in preparation for a post of an Open * Graph object or action which references the image. The URI returned when uploading a staging * resource may be passed as the image property for an Open Graph object or action. * * @param accesstoken the access token to use,or null * @param imageUri the file:// or content:// Uri pointing to the image to upload * @param callback a callback that will be called when the request is completed to handle * success or error conditions * @return a Request that is ready to execute * @throws FileNotFoundException */ public static GraphRequest newUploadStagingResourceWithImageRequest( Accesstoken accesstoken,Uri imageUri,Callback callback ) throws FileNotFoundException { if (Utility.isFileUri(imageUri)) { return newUploadStagingResourceWithImageRequest( accesstoken,new File(imageUri.getPath()),callback); } else if (!Utility.isContentUri(imageUri)) { throw new FacebookException("The image Uri must be either a file:// or content:// Uri"); } GraphRequest.ParcelableResourceWithMimeType<Uri> resourceWithMimeType = new GraphRequest.ParcelableResourceWithMimeType<>(imageUri,"image/png"); Bundle parameters = new Bundle(1); parameters.putParcelable(STAGING_ParaM,resourceWithMimeType); return new GraphRequest( accesstoken,MY_STAGING_RESOURCES,parameters,HttpMethod.POST,callback); }
public static Bundle create( UUID callId,"callId"); Bundle nativeParams = null; if (shareContent instanceof ShareLinkContent) { final ShareLinkContent linkContent = (ShareLinkContent)shareContent; nativeParams = create(linkContent,shouldFailOnDataError); } else if (shareContent instanceof SharePhotoContent) { final SharePhotoContent photoContent = (SharePhotoContent)shareContent; List<String> photoUrls = ShareInternalUtility.getPhotoUrls( photoContent,shouldFailOnDataError); } else if (shareContent instanceof ShareVideoContent) { final ShareVideoContent videoContent = (ShareVideoContent)shareContent; nativeParams = create(videoContent,openGraphContent); nativeParams = create(openGraphContent,shouldFailOnDataError); } catch (final JSONException e) { throw new FacebookException( "Unable to create a JSON Object from the provided ShareOpenGraphContent: " + e.getMessage()); } } return nativeParams; }
@Override protected void handleSuccess(JSONObject jsonObject) throws JSONException { if (jsonObject.getBoolean("success")) { issueResponSEOnMainThread(null,uploadContext.videoId); } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } }
@Override public void run() { if (!uploadContext.isCanceled) { try { executeGraphRequestSynchronously(getParameters()); } catch (FacebookException fe) { endUploadWithFailure(fe); } catch (Exception e) { endUploadWithFailure(new FacebookException(ERROR_UPLOAD,e)); } } else { // No specific failure here. endUploadWithFailure(null); } }
protected void executeGraphRequestSynchronously(Bundle parameters) { GraphRequest request = new GraphRequest( uploadContext.accesstoken,String.format(Locale.ROOT,"%s/videos",uploadContext.graphNode),null); GraphResponse response = request.executeAndWait(); if (response != null) { FacebookRequestError error = response.getError(); JSONObject responseJSON = response.getJSONObject(); if (error != null) { if (!attemptRetry(error.getSubErrorCode())) { handleError(new FacebookGraphResponseException(response,ERROR_UPLOAD)); } } else if (responseJSON != null) { try { handleSuccess(responseJSON); } catch (JSONException e) { endUploadWithFailure(new FacebookException(ERROR_BAD_SERVER_RESPONSE,e)); } } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } }
protected void issueResponSEOnMainThread( final FacebookException error,final String videoId) { getHandler().post(new Runnable() { @Override public void run() { issueResponse(uploadContext,error,videoId); } }); }
/** * Share the content. * * @param callback the callback to call once the share is complete. */ public void share(FacebookCallback<Sharer.Result> callback) { if (!this.canShare()) { ShareInternalUtility.invokeCallbackWithError( callback,"Insufficient permissions for sharing content via Api."); return; } final ShareContent shareContent = this.getShareContent(); // Validate the share content try { ShareContentValidation.validateForApiShare(shareContent); } catch (FacebookException ex) { ShareInternalUtility.invokeCallbackWithException(callback,ex); return; } if (shareContent instanceof ShareLinkContent) { this.shareLinkContent((ShareLinkContent) shareContent,callback); } else if (shareContent instanceof SharePhotoContent) { this.sharePhotoContent((SharePhotoContent) shareContent,callback); } else if (shareContent instanceof ShareVideoContent) { this.shareVideoContent((ShareVideoContent) shareContent,callback); } else if (shareContent instanceof ShareOpenGraphContent) { this.shareOpenGraphContent((ShareOpenGraphContent) shareContent,callback); } }
public static Bundle createBundleForException(FacebookException e) { if (e == null) { return null; } Bundle errorBundle = new Bundle(); errorBundle.putString(BRIDGE_ARG_ERROR_DESCRIPTION,e.toString()); if (!(e instanceof FacebookOperationCanceledException)) { return errorBundle; } errorBundle.putString(BRIDGE_ARG_ERROR_TYPE,ERROR_USER_CANCELED); return errorBundle; }
com.facebook.FacebookGraphObjectException的实例源码
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
void updateObjectAttachmentUrls(String objectProperty,List<String> attachmentUrls,boolean isUserGenerated) { final OpenGraphObject object; try { object = action.getPropertyAs(objectProperty,OpenGraphObject.class); if (object == null) { throw new IllegalArgumentException("Action does not contain a property '" + objectProperty + "'"); } } catch (FacebookGraphObjectException exception) { throw new IllegalArgumentException("Property '" + objectProperty + "' is not a graph object"); } if (!object.getCreateObject()) { throw new IllegalArgumentException( "The Open Graph object in '" + objectProperty + "' is not marked for creation"); } GraphObjectList<GraphObject> attachments = object.getimage(); if (attachments == null) { attachments = GraphObject.Factory.createList(GraphObject.class); } for (String url : attachmentUrls) { GraphObject graphObject = GraphObject.Factory.create(); graphObject.setProperty(NativeProtocol.IMAGE_URL_KEY,url); if (isUserGenerated) { graphObject.setProperty(NativeProtocol.IMAGE_USER_GENERATED_KEY,true); } attachments.add(graphObject); } object.setimage(attachments); }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@SmallTest @MediumTest @LargeTest public void testCantWrapBadPropertyNameOverrides() { try { GraphObject.Factory.create(BadPropertyOverrideInterfaceGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> paramClass) { if (GraphObject.class.isAssignableFrom(this.itemType)) { if (paramClass.isAssignableFrom(this.itemType)) return this; return GraphObject.Factory.createList(this.state,paramClass); } throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + this.itemType); }
@SmallTest @MediumTest @LargeTest public void testCantWrapBadGetterName() { try { GraphObject.Factory.create(BadGetterNameGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@SmallTest @MediumTest @LargeTest public void testCantWrapBadZeroParameterMethodName() { try { GraphObject.Factory.create(BadnoparameterMethodNameGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@SmallTest @MediumTest @LargeTest public void testCantWrapBadSetterName() { try { GraphObject.Factory.create(BadSetterNameGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@SmallTest @MediumTest @LargeTest public void testCantWrapBadGetterParams() { try { GraphObject.Factory.create(BadGetterParamsGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@SmallTest @MediumTest @LargeTest public void testCantWrapBadBaseInterface() { try { GraphObject.Factory.create(BadBaseInterfaceGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@SmallTest @MediumTest @LargeTest public void testCantWrapBadSingleParameterMethodName() { try { GraphObject.Factory.create(BadSingleParameterMethodNameGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@Override public final <U extends GraphObject> GraphObjectList<U> castTolistof(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state,graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
@SmallTest @MediumTest @LargeTest public void testCantWrapNonInterface() { try { GraphObject.Factory.create(GraphObjectClass.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
@SmallTest @MediumTest @LargeTest public void testCantWrapBadZeroParameterMethodName() { try { GraphObject.Factory.create(BadnoparameterMethodNameGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
com.facebook.FacebookGraphResponseException的实例源码
@Override public void onCompleted(GraphResponse response) { FacebookRequestError error = response.getError(); if (error != null) { Logger.logError(RequestAction.class,"Failed to get what you have requested",error.getException()); if (mSingleEmitter != null) { mSingleEmitter.onError(error.getException()); } } else { if (response.getRawResponse() == null) { Logger.logError(RequestAction.class,"The response GraphObject " + "has null value. Response=" + response.toString(),null); mSingleEmitter.onError(new FacebookGraphResponseException(response,"The response has null value")); } else { if (mSingleEmitter != null) { mSingleEmitter.onSuccess(response); } } } }
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)); } }
protected void executeGraphRequestSynchronously(Bundle parameters) { GraphRequest request = new GraphRequest( uploadContext.accesstoken,String.format(Locale.ROOT,"%s/videos",uploadContext.graphNode),parameters,HttpMethod.POST,null); GraphResponse response = request.executeAndWait(); if (response != null) { FacebookRequestError error = response.getError(); JSONObject responseJSON = response.getJSONObject(); if (error != null) { if (!attemptRetry(error.getSubErrorCode())) { handleError(new FacebookGraphResponseException(response,ERROR_UPLOAD)); } } else if (responseJSON != null) { try { handleSuccess(responseJSON); } catch (JSONException e) { endUploadWithFailure(new FacebookException(ERROR_BAD_SERVER_RESPONSE,e)); } } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } }
private static void invokeOnErrorCallback( FacebookCallback<Sharer.Result> callback,message)); } }
static void invokeOnErrorCallback( FacebookCallback<Sharer.Result> callback,message)); } }
protected void executeGraphRequestSynchronously(Bundle parameters) { GraphRequest request = new GraphRequest( uploadContext.accesstoken,uploadContext.targetId),e)); } } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } }
关于Facebook Marketing API - 广告计费交易和facebook广告如何计算费用的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于android – Facebook Pixel Conversion(Facebook广告)未在Ionic框架中更新、com.facebook.FacebookException的实例源码、com.facebook.FacebookGraphObjectException的实例源码、com.facebook.FacebookGraphResponseException的实例源码等相关知识的信息别忘了在本站进行查找喔。
本文标签: