@Override public void onError(AppCall appCall, FacebookException error) { Logger.log( LoggingBehavior.REQUESTS, TAG, "Like Dialog failed with error : %s", error); Bundle logParams = analyticsParameters == null ? new Bundle() : analyticsParameters; logParams.putString( AnalyticsEvents.PARAMETER_CALL_ID, appCall.getCallId().toString()); // Log the error and AppEvent logAppEventForError("present_dialog", logParams); broadcastAction( LikeActionController.this, ACTION_LIKE_ACTION_CONTROLLER_DID_ERROR, NativeProtocol.createBundleForException(error)); }
/** * Use this method to set a result on an Activity, where the result needs to be in the shape * of the native protocol used for native dialogs. */ public static Intent createProtocolResultIntent( Intent requestIntent, Bundle results, FacebookException error) { UUID callId = NativeProtocol.getCallIdFromIntent(requestIntent); if (callId == null) { return null; } Intent resultIntent = new Intent(); resultIntent.putExtra(EXTRA_PROTOCOL_VERSION, getProtocolVersionFromIntent(requestIntent)); Bundle bridgeArguments = new Bundle(); bridgeArguments.putString(BRIDGE_ARG_ACTION_ID_STRING, callId.toString()); if (error != null) { bridgeArguments.putBundle( BRIDGE_ARG_ERROR_BUNDLE, NativeProtocol.createBundleForException(error)); } resultIntent.putExtra(EXTRA_PROTOCOL_BRIDGE_ARGS, bridgeArguments); if (results != null) { resultIntent.putExtra(EXTRA_PROTOCOL_METHOD_RESULTS, results); } return resultIntent; }
public static void setupAppCallForErrorResult(AppCall appCall, FacebookException exception) { if (exception == null) { return; } Validate.hasFacebookActivity(FacebookSdk.getApplicationContext()); Intent errorResultIntent = new Intent(); errorResultIntent.setClass(FacebookSdk.getApplicationContext(), FacebookActivity.class); errorResultIntent.setAction(FacebookActivity.PASS_THROUGH_CANCEL_ACTION); NativeProtocol.setupProtocolRequestIntent( errorResultIntent, appCall.getCallId().toString(), null, NativeProtocol.getLatestKnownVersion(), NativeProtocol.createBundleForException(exception)); appCall.setRequestIntent(errorResultIntent); }