-1

I'm using the GoViral ANE from milkman games. The extension seems to connect to facebook properly. It connects with my profile. I can see my profile picture and I get a prompt asking if I would like to connect fb with my profile. No errors throughout this process. I can see my friends list when I choose to invite friends. When I send them the invite, they never receive a notification. It also doesn't show pages to "like". When I try to show a fan page/like page, fb loads and says data not found. In the fb settings I have single sign on set to yes. I have deep linkage set to yes as well. I do not have both platforms set up on facebook though. I only have the android platform set up. I dont know if this could be an issue or not. But as I said, It's connecting with my profile and showing my friends list when trying to invite. It's just not actually doing anything afterward. I'm receiving no errors.

        if( GoViral.isSupported() ){
            GoViral.create();
        }else{
            trace( "GoViral only works on mobile!" );
            return;
        }
        if( GoViral.goViral.isFacebookSupported() ){
            //replace 000000 with your facebook app id!
            GoViral.goViral.initFacebook( "my fb id","" );
        }
        btn_connectFacebook.addEventListener( MouseEvent.CLICK, connectToFacebook );
        GoViral.goViral.addEventListener( G   VFacebookEvent.FB_LOGGED_IN,successfulLogIn );
        //GoViral.goViral.addEventListener( GVFacebookEvent.FB_LOGIN_CANCELED,onFacebookEvent );
        GoViral.goViral.addEventListener( GVFacebookEvent.FB_LOGIN_FAILED,logInFailed );

  public function connectToFacebook(e:MouseEvent){
        if(!GoViral.goViral.isFacebookAuthenticated()){
            // show a connect with Facebook prompt.
            // this method takes a comma separated list of facebook READ permissions as a first
            // parameter. You should have at least one read permission.
            // you can refer to the facebook documentation at
            // http://developers.facebook.com/docs/authentication/permissions/ to determine which
            // permissions your app requires.
            GoViral.goViral.authenticateWithFacebook( "public_profile");
        }
    }

    public function successfulLogIn( e:GVFacebookEvent ){
        //No longer need to connect to fb
        hasConnectedToFb = true;
        maintenanceSO.data.need2Connect2FB = false;
        connectedToFb();
        GoViral.goViral.presentFacebookPageOrProfile("last digits of my fb fan page url");

        GoViral.goViral.showFacebookRequestDialog(
        "Play my game",
        "Play this game with me!").addDialogListener(function(e:GVFacebookEvent):void {
            switch(e.type)
            {
                case GVFacebookEvent.FB_DIALOG_CANCELED:
                    //log("The Invite Dialog was canceled.");
                    MovieClip( root ).gotoAndStop( "didntWork" );
                    break;
                case GVFacebookEvent.FB_DIALOG_FAILED:
                    MovieClip( root ).gotoAndStop( "didntWork" );
                    break;
                case GVFacebookEvent.FB_DIALOG_FINISHED:
                    //log("Successfully invited friends dialog:"+e.jsonData);
                    if(e.data.to)
                    {
                        MovieClip( root ).gotoAndStop( "didWork" );
                        //log("Invited these people :"+e.data.to.join(","));
                    }
                    break;
            }
        });

    }
rtpenick
  • 125
  • 7

1 Answers1

0

Assuming that you already have checked if the ANE is supported and initialized using your Facebook app id.

    if(GoViral.goViral.isFacebookSupported())
    {
        // replace 000000 with your facebook app id!
        GoViral.goViral.initFacebook("000000","");
    }

The GoViral extension can prompt the user to invite their friends to your app, using showFacebookRequestDialog(). The most basic use of the Request Dialog is to invite friends to come and play your game:

    // show a dialog inviting friends to install the game
    GoViral.goViral.showFacebookRequestDialog("Play my game", "Won't you play with me?").addDialogListener(function(event:GVFacebookEvent):void
    {
        switch (event.type)
        {
            case GVFacebookEvent.FB_DIALOG_CANCELED:
                trace("The Request Dialog was canceled.");
                break;
            case GVFacebookEvent.FB_DIALOG_FAILED:
                trace("The Request Dialog has failed:" + event.errorMessage);
                break;
            case GVFacebookEvent.FB_DIALOG_FINISHED:
                trace("These ids were invited:" + event.data.to.join(","));
                break;
        }
    });

The request dialog supports a number of additiional parameters for building more complex requests, shown below. You can learn more about making complex dialog requests at https://developers.facebook.com/docs/games/requests/v2.0#params

public function showFacebookRequestDialog(message:String, title:String = null, data:String = null, filters:String = null, to:String = null, excludeIds:String = null, frictionless:Boolean = false, actionType:String = null, objectID:String = null, suggestions:String = null):GVFacebookDispatcher

message:String — The message to include with the request. Max length of 255 characters- this will be truncated if it's more than that.

title:String(default=null)— Optional. Title to show on the request. Max length of 50 characters- this will be truncated if it's more than that.

data:String(default=null)— Optional. Extra data string for the request. Max length of 255 characters- this will be truncated if it's more than that.

filters:String(default=null)— Optional. DEPRECATED. Facebook may ignore this parameter on mobile SDKs. As an alternative, load the user's friends with a facebookGraphRequest, and post the necessary IDs to the excludeIds or to parameters. Allows filtering of recipients to GVFacebookRequestFilter.APP_USERS, or GVFacebookRequestFilter.APP_NON_USERS.

to:String(default=null)— Optional. A String facebook ID for the request to go to, or a comma delimited list of such IDs. If this is not set, a standard friend selector will appear.

excludeIds:String(default=null)— Optional. A comma delimited list of Facebook User IDs to exclude from the dialog picker.

frictionless:Boolean(default=false)— Optional. Set to 'true' to make this a frictionless request. See Facebook developer documentation for more information.

actionType:String(default=null)— Optional. Used when defining additional context about the nature of the request. One of GVFacebookRequestActionType.ASK_FOR, GVFacebookRequestActionType.SEND, or GVFacebookRequestActionType.TURN.

objectID:String(default=null)— Optional. The Open Graph Object ID of the object being send via the actionType parameter.

suggestions:String(default=null)— Optional. A comma delimited list of user IDs that will be included in the dialog as the first suggested friends. Note: This parameter is can not be used together with filters. Using the two in the same dialog will result with an error.

Presenting a Facebook Page View (“Like us On Facebook”)

Facebook does not allow all mobile applications to programatically “Like” a Facebook page- however you can direct the user to your Facebook Page view, where they can choose to press the “Like” button, or otherwise interact with your company.

You can present the page view by passing the page's ID to the presentFacebookPageOrProfile() method. The Page ID can easily be determind by visiting the page in the browser, and copying the numeric ID from the end of the URL. For instance, Milkman Games' Facebook page URL is https://www.facebook.com/pages/Milkman-Games-LLC/215322531827565, so the ID is 215322531827565:

     // send the user to your Facebook page to complete other actions
     GoViral.goViral.presentFacebookPageOrProfile("215322531827565");
gabriel
  • 2,351
  • 4
  • 20
  • 23
  • thanks for your help. I editing my question to make it more concise. I did all of the things you mentioned above and it's not sending my invitations or showing like pages. – rtpenick Feb 05 '15 at 18:04
  • What kind of message do you receive? Have you tried to check if there is some error? – gabriel Feb 05 '15 at 19:15
  • I don't receive any errors. As you see I added keyframes "did work" and "didn't work" for failed invites and successful ones. It shows a successful send every time. Did you add both platforms before you tested it? – rtpenick Feb 05 '15 at 19:21
  • I just followed the documentation/user guide (PDF file that I download with the ANE file), it's very concise and organized. Maybe is better you try to restart the flow, and pay attention step by step. Good luck! – gabriel Feb 10 '15 at 09:47