Forums

OverviewV-Play 1 Support › About FaceBook plugin

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #5360

    Heini

    Hi,

    I am playing around with the facebook-plugin but just not able to get it run properly. When I run the facebooktest example shipped with vplay on my Android phone, it seems that the only button working is the login button. After clicking it, it opens up the facebook login dialog, which closes after entering my username and password. Back to the “mainmenu”, I can click whatever button I like, nothing happens.

    Then I changed the code to keep only the possibility to login and post something on the users wall:

     

    import VPlay 1.0
    import QtQuick 1.1
    import VPlay.plugins.facebook 1.0
    
    
    GameWindow {
    
      Facebook {
    
        id: facebook
        appId: "489472511074353" // V-Play Test App 2, created by Chris
    
        readPermissions: ["email", "read_friendlists"]
        publishPermissions: ["publish_actions"]
    
        onSessionStateChanged: {
          console.log("New Facebook Session state: ", sessionState);
    
          if (sessionState === Facebook.Opened) {
              myText.text = "Facebook session opened."
              facebook.openWallDialog( {
                                  "link" : "www.v-play.net",
                                  "description" : "This is the description",
                                  "name" : "V-Play name!",
                                  "caption" : "V-Play caption ..."
                                      } )
          }
          else if (sessionState === Facebook.Closed) {
            myText.text = "Facebook session closed."
          }
          else if (sessionState === Facebook.Failed) {
            myText.text = "Facebook session failed."
          }
        }
    
      } // end of Facebook item
    
    
      Rectangle {
        anchors.fill: parent
        color: "black"
      }
    
      Scene {
        id: scene
    
        SimpleButton{
            id: myButton
            text: "Post on Facebook wall"
            anchors.centerIn: parent
    
            onClicked: {
                myText.text = "Button klicked."
                facebook.openSession();
            }
        }
    
        Text{
            id: myText
            anchors.bottom: parent.bottom
            anchors.horizontalCenter: parent.horizontalCenter
            text: "currently no action"
            color: "white"
        }
      } // end of Scene
    }

    I kept the same appID like in the vplay-example. Now after login, on the bottom of the screen appears “Facebook session failed”.

    Can you please tell me, what´s going wrong?

     

    Thanks

    Heini

    #5361

    Heini

    Guybrush said:

    Hi,

    I am playing around with the facebook-plugin but just not able to get it run properly. When I run the facebooktest example shipped with vplay on my Android phone, it seems that the only button working is the login button. After clicking it, it opens up the facebook login dialog, which closes after entering my username and password. Back to the “mainmenu”, I can click whatever button I like, nothing happens.

    Then I changed the code to keep only the possibility to login and post something on the users wall:

     

    import VPlay 1.0
    import QtQuick 1.1
    import VPlay.plugins.facebook 1.0
    
    GameWindow {
    
      Facebook {
    
        id: facebook
        appId: "489472511074353" // V-Play Test App 2, created by Chris
    
        readPermissions: ["email", "read_friendlists"]
        publishPermissions: ["publish_actions"]
    
        onSessionStateChanged: {
          console.log("New Facebook Session state: ", sessionState);
    
          if (sessionState === Facebook.Opened) {
              myText.text = "Facebook session opened."
              facebook.openWallDialog( {
                                  "link" : "www.v-play.net",
                                  "description" : "This is the description",
                                  "name" : "V-Play name!",
                                  "caption" : "V-Play caption ..."
                                      } )
          }
          else if (sessionState === Facebook.Closed) {
            myText.text = "Facebook session closed."
          }
          else if (sessionState === Facebook.Failed) {
            myText.text = "Facebook session failed."
          }
        }
    
      } // end of Facebook item
    
      Rectangle {
        anchors.fill: parent
        color: "black"
      }
    
      Scene {
        id: scene
    
        SimpleButton{
            id: myButton
            text: "Post on Facebook wall"
            anchors.centerIn: parent
    
            onClicked: {
                myText.text = "Button klicked."
                facebook.openSession();
            }
        }
    
        Text{
            id: myText
            anchors.bottom: parent.bottom
            anchors.horizontalCenter: parent.horizontalCenter
            text: "currently no action"
            color: "white"
        }
      } // end of Scene
    }

    I kept the same appID like in the vplay-example. Now after login, on the bottom of the screen appears “Facebook session failed”.

    Can you please tell me, what´s going wrong?

     

    EDIT: I have no facebook app installed on my phone.

     

    Thanks

    Heini

     

    #5377

    Alex
    V-Play Team

    Hi Heini,

    unfortunately our Facebook App was in sandbox mode, that’s why the FacebookTest example didn’t work.

    If you want to test Facebook in your own project you either need to change the identifier in your config.json to “net.vplay.plugins.facebooktest” or you can create your own Facebook App like described here http://v-play.net/doc/plugins1-facebook.html#create-a-facebook-app.

    Cheers,
    Alex

     

    #5379

    Heini

    Thank you, its working now!

    #5382

    Heini

    Hi,

    just another question: is there already, or maybe planned for the future, an overloaded function like openSession(username, password) to login the facebook account? So the username and password could be stored in the database and it would not be necessary to enter it every time the app is connecting to facebook.

     

    Cheers

    Heini

    #5384

    Alex
    V-Play Team

    Guybrush said:

    just another question: is there already, or maybe planned for the future, an overloaded function like openSession(username, password) to login the facebook account? So the username and password could be stored in the database and it would not be necessary to enter it every time the app is connecting to facebook.

    Hi Heini,

    the Facebook plugin (and the official Facebook SDK) is designed to perform all login activity with Facebook Single Sign On, meaning that a user only needs to provide his credentials once and authorize your game for every requested permission. After the first login a token is saved within your app bundle which can then be used to re-open an old session without leaving your app when calling the openSession method. So you don’t have to save username and password on your own (most users probably won’t provide you (as 3rd party app developer) their details at all).

    Are there any problems with this approach to your mind?

    Thanks,

    Alex

    #5393

    Heini

    Hi Alex,

    thank you for your explainations! You are absolutely right. Because the fault described above, i had to login often and did not realize, that after a succesful login, i don´t have to enter the credentials again. Sorry about that.

     

    Heini

Viewing 7 posts - 1 through 7 (of 7 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support