public override void Init(
            InitDelegate onInitComplete,
            string appId,
            bool cookie,
            bool logging,
            bool status,
            bool xfbml,
            string channelUrl,
            string authResponse,
            bool frictionlessRequests,
            HideUnityDelegate hideUnityDelegate)
        {
            if (string.IsNullOrEmpty(appId))
            {
                throw new ArgumentException("appId cannot be null or empty!");
            }

            var args = new MethodArguments();

            args.addNonNullOrEmptyParameter("appId", appId);
            args.addNonNullParameter("cookie", cookie);
            args.addNonNullParameter("logging", logging);
            args.addNonNullParameter("status", status);
            args.addNonNullParameter("xfbml", xfbml);
            args.addNonNullOrEmptyParameter("channelUrl", channelUrl);
            args.addNonNullOrEmptyParameter("authResponse", authResponse);
            args.addNonNullParameter("frictionlessRequests", frictionlessRequests);
            var initCall = new JavaMethodCall <IResult>(this, "Init");

            initCall.call(args);
            this.CallFB("SetUserAgentSuffix",
                        String.Format("Unity.{0}", Facebook.Unity.FacebookSdkVersion.Build));
        }
        public override void Init(
            InitDelegate onInitComplete,
            string appId,
            bool cookie,
            bool logging,
            bool status,
            bool xfbml,
            string channelUrl,
            string authResponse,
            bool frictionlessRequests,
            HideUnityDelegate hideUnityDelegate)
        {
            if (string.IsNullOrEmpty(appId))
            {
                throw new ArgumentException("appId cannot be null or empty!");
            }

            if (CanvasFacebook.IntegrationMethodJs == null)
            {
                throw new Exception("Cannot initialize facebook javascript");
            }

            this.onInitComplete      = onInitComplete;
            this.OnHideUnityDelegate = hideUnityDelegate;
            Application.ExternalEval(CanvasFacebook.IntegrationMethodJs);
            this.appId = appId;

            bool isPlayer = true;

            #if UNITY_WEBGL
            isPlayer = false;
            #endif

            MethodArguments parameters = new MethodArguments();
            parameters.addNonNullOrEmptyParameter("appId", appId);
            parameters.addNonNullParameter("cookie", cookie);
            parameters.addNonNullParameter("logging", logging);
            parameters.addNonNullParameter("status", status);
            parameters.addNonNullParameter("xfbml", xfbml);
            parameters.addNonNullOrEmptyParameter("channelUrl", channelUrl);
            parameters.addNonNullOrEmptyParameter("authResponse", authResponse);
            parameters.addNonNullParameter("frictionlessRequests", frictionlessRequests);
            parameters.addNonNullOrEmptyParameter("version", SDKVersion);
            // use 1/0 for booleans, otherwise you'll get strings "True"/"False"
            Application.ExternalCall(
                "FBUnity.init",
                isPlayer ? 1 : 0,
                FacebookConnectURL,
                sdkLocale,
                sdkDebug ? 1 : 0,
                parameters.ToJsonString(),
                status ? 1 : 0);
        }
        public override void AppRequest(
            string message,
            OGActionType actionType,
            string objectId,
            string[] to,
            List <object> filters,
            string[] excludeIds,
            int?maxRecipients,
            string data,
            string title,
            FacebookDelegate <IAppRequestResult> callback)
        {
            ValidateAppRequestArgs(
                message,
                actionType,
                objectId,
                to,
                filters,
                excludeIds,
                maxRecipients,
                data,
                title,
                callback
                );

            MethodArguments args = new MethodArguments();

            args.addNonNullOrEmptyParameter("message", message);
            args.addCommaSeperateListNonNull("to", to);
            args.addNonNullOrEmptyParameter("action_type", actionType != null ? actionType.ToString() : null);
            args.addNonNullOrEmptyParameter("object_id", objectId);
            args.addNonNullParameter("filters", filters);
            args.addNonNullParameter("exclude_ids", excludeIds);
            args.addNonNullOrEmptyParameter("max_recipients", maxRecipients);
            args.addNonNullOrEmptyParameter("data", data);
            args.addNonNullOrEmptyParameter("title", title);
            var call = new CanvasUIMethodCall <IResult>(this, MethodAppRequests, Constants.OnAppRequestsCompleteMethodName);

            call.call(args);
        }