protected void onCreate()

in facebook-android-wrapper/src/com/facebook/unity/FBUnityCreateGamingContextActivity.java [35:77]


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

        Intent intent = getIntent();
        Bundle params = intent.getBundleExtra(BaseActivity.ACTIVITY_PARAMS);

        final UnityMessage response = new UnityMessage("OnCreateGamingContextComplete");
        String callbackID = params.getString(Constants.CALLBACK_ID_KEY);
        Log.e(TAG, "callbackID: " + callbackID);
        if (callbackID != null) {
            response.put(Constants.CALLBACK_ID_KEY, callbackID);
        }

        String playerID = params.getString("playerID");
        ContextCreateContent.Builder builder = new ContextCreateContent.Builder();
        builder.setSuggestedPlayerID(playerID);
        
        ContextCreateContent content = builder.build();

        ContextCreateDialog dialog = new ContextCreateDialog(this);
        dialog.registerCallback(mCallbackManager, new FacebookCallback<ContextCreateDialog.Result>() {
            @Override
            public void onSuccess(ContextCreateDialog.Result result) {
                response.put("contextId", result.getContextID());
                response.send();
                FBUnityCreateGamingContextActivity.this.finish();
            }

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

            @Override
            public void onError(FacebookException e) {
                response.sendError(e.getMessage());
                FBUnityCreateGamingContextActivity.this.finish();
            }
        });
        dialog.show(content);
    }