SahJ Posted September 24, 2018 Share Posted September 24, 2018 When you selected a friend to create a new context. How can I make that new context be created when my friend accepts? FBInstant.context.chooseAsync().then(function (result) { console.log(FBInstant.context.chooseAsync()) window.FBInstant.updateAsync({ action: 'CUSTOM', intent: 'REQUEST', cta: 'Play', template: "join_fight", image: base64Picture, //this should be source data of your share picture in //base64! you can parse your picture to base64 use //'https://www.base64-image.de' text: "X just invaded Y's village!", data: { myReplayData: "..." }, strategy: 'IMMEDIATE', notification: 'NO_PUSH' }).then(function () { // closes the game after the update is posted. console.log("FBINSTANT Quit"); FBInstant.context.createAsync(playerID) FBInstant.context.getPlayersAsync().then(function (result, error) { console.log(result); }) }); console.log(result) }).catch(function (err) { console.error(err); }); Quote Link to comment Share on other sites More sharing options...
Noel Posted September 25, 2018 Share Posted September 25, 2018 Hi @SahJ, I do not understand your question. When choosing a context with chooseAsync, the client will try to switch to that context and resolve. What do you mean by "when my friend accepts"? console.log(FBInstant.context.chooseAsync()) -> why are you logging a method call? Did you set base64Picture properly? chooseAsync( ) Opens a context selection dialog for the player. If the player selects an available context, the client will attempt to switch into that context, and resolve if successful. Otherwise, if the player exits the menu or the client fails to switch into the new context, this function will reject. Quote Link to comment Share on other sites More sharing options...
SahJ Posted September 25, 2018 Author Share Posted September 25, 2018 I'm sorry if my question is a little fuzzy, I'll try to detail it more. When I invite my friend, chooseAsync () creates the context for me and my friend before my friend accepts, is there any way to create the context after my friend accepts, it's like doing a duel game, both of them play at the same time and who wins the highest score? I mean, you can get a callback to know when my friend accepts Quote Link to comment Share on other sites More sharing options...
Noel Posted September 26, 2018 Share Posted September 26, 2018 Hi @SahJ, I think I understand. You should use the field data in updateAsync when inviting from player A: data: { myReplayData: '...' } And then use FBInstant.getEntryPointData() with player B to retrieve the information that it was an invitation from player A. Quote Link to comment Share on other sites More sharing options...
SahJ Posted October 18, 2018 Author Share Posted October 18, 2018 I was using this method and it works when player B enters the game with the frame that sends shareAsync () by messenger, up here well, but player A has the getEntryPointData () equal to null. My idea is to create a waiting room where player A waits for a certain amount of time for Player B to enter and skip the game. Quote Link to comment Share on other sites More sharing options...
Bonomi Posted February 28, 2020 Share Posted February 28, 2020 I have the same doubt. Is there any push notification system or the only way to notify the other user is through a new message in the chat window? What I wanted was to avoid closing the game after the user plays and reopen it again Quote Link to comment Share on other sites More sharing options...
Superatons Posted May 8, 2020 Share Posted May 8, 2020 On 2/28/2020 at 5:33 AM, Bonomi said: I have the same doubt. Is there any push notification system or the only way to notify the other user is through a new message in the chat window? What I wanted was to avoid closing the game after the user plays and reopen it again did you know how to do it? Quote Link to comment Share on other sites More sharing options...
Bonomi Posted May 8, 2020 Share Posted May 8, 2020 No, I don't. I believe it is not possible on the fb instant games. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.