FBInstant.player.getConnectedPlayersAsync() always returns empty

124 views Asked by At

my code is:

let global_config = {

};
window.onload = function (e) {
  FBInstant.initializeAsync()
    .then(function () {
      FBInstant.startGameAsync()
        .then(function () {
          var contextId = FBInstant.context.getID();
          var contextType = FBInstant.context.getType();

          var playerName = FBInstant.player.getName();
          var playerPic = FBInstant.player.getPhoto();
          var playerId = FBInstant.player.getID();

          global_config["contextId"] = contextId;
          global_config["contextType"] = contextType;
          global_config["playerName"] = playerName;
          global_config["playerPic"] = playerPic;
          global_config["playerId"] = playerId;

          console.log("default", global_config);

          FBInstant.player.getConnectedPlayersAsync()
            .then(function (players) {
              console.log("getConnectedPlayersAsync", players);
            }).catch(err => {
              console.error("getConnectedPlayersAsync", err);
            });
        });
  });
}

The game is currently in development mode. I invited a few friends to test. The friends have authorized the game, but calling FBInstant.player.getConnectedPlayersAsync() api keeps returning empty.

I want to know where is the problem and how to solve it

1

There are 1 answers

0
artwl On

Found the reason, user_friends permissions need to be audited