protected void onCreate()

in facebook-android-wrapper/src/com/facebook/unity/FBUnityDialogsActivity.java [42:96]


    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent intent = getIntent();
        ShareContent shareContent;
        Bundle params;
        if (intent.hasExtra(SHARE_DIALOG_PARAMS)) {
            params = intent.getBundleExtra(SHARE_DIALOG_PARAMS);
            shareContent = FBDialogUtils.createShareContentBuilder(params).build();
        } else if (intent.hasExtra(FEED_DIALOG_PARAMS)) {
            params = intent.getBundleExtra(FEED_DIALOG_PARAMS);
            shareContent = FBDialogUtils.createFeedContentBuilder(params).build();
        } else {
            Log.e(TAG,
                    String.format(
                            Locale.ROOT,
                            "Failed to find extra %s or %s",
                            SHARE_DIALOG_PARAMS,
                            FEED_DIALOG_PARAMS));
            finish();
            return;
        }

        ShareDialog dialog = new ShareDialog(this);
        final UnityMessage response = new UnityMessage("OnShareLinkComplete");
        String callbackID = params.getString(Constants.CALLBACK_ID_KEY);
        if (callbackID != null) {
            response.put(Constants.CALLBACK_ID_KEY, callbackID);
        }

        dialog.registerCallback(mCallbackManager, new FacebookCallback<Sharer.Result>() {
            @Override
            public void onSuccess(Sharer.Result result) {
                if (result.getPostId() != null) {
                    response.putID(result.getPostId());
                }
                // Unity SDK requires to have at least one key beside callback_id.
                response.put("posted", true);
                response.send();
            }

            @Override
            public void onCancel() {
                response.putCancelled();
                response.send();
            }

            @Override
            public void onError(FacebookException e) {
                response.sendError(e.getMessage());
            }
        });
        ShareDialog.Mode mode = (ShareDialog.Mode) getIntent().getSerializableExtra(DIALOG_TYPE);
        dialog.show(shareContent, mode);
    }