4

When I try to upload my simple game/app, I get an error saying

"Games must reference one of our supported SDKs via our CDN."

I have given an SDK reference though. Isn't this the one?

<script src="https://connect.facebook.net/en_US/fbInstant.6.2.js"></script>

I went through the SDK reference of facebook docs as well but it didn't work for me? Did anyone face same situation before or have an idea to fix this problem? thank you

I have a file index.html

INDEX.HTML

 <html>
  <head>
    <title>
        this is test
</title>
<style>
body {
  width: 400px;
  height: 400px;
  position: 0;
  background: yellow;
 }
    #heading1{

  position: absolute;

}
    </style>
</head>

<body>
<h1 id="heading1">
This is h1.
</h1>
<button onclick="myFunction()">Move the heading</button>
<script>
var ran = Mathfloor.Math.Random()*1;
function myFunction() {
var move= document.getElementById("heading1");
 var pos = 0;
  var id = setInterval(frame, 5);
  function frame() {
if (pos == 350) {
 clearInterval(id);
  var id1 = setInterval(framenext, 5);
} else {
  pos++; 
  if (ran ==1) {
  move.style.top = pos + "px"; }else {
  move.style.left = pos + "px"; }
}
}
     function framenext() {
if (pos == 0) {
  clearInterval(id1);
  var id = setInterval(framenext, 5);
} else {
  pos--; 
  if (ran ==1) {
  move.style.top = pos + "px"; }else {
  move.style.left = pos + "px"; }
   }
   }

    }
</script>
<script src="https://connect.facebook.net/en_US/fbInstant.6.2.js"</script>
    </body>
</html>

fbapp-config.json

 {
    "instant_games":{
     "navigation_menu_version": "NAV_FLOATING",
     }
  }
sparsh
  • 1,438
  • 1
  • 15
  • 34
Potato23
  • 65
  • 1
  • 6

1 Answers1

4
<body>
<script src="https://connect.facebook.net/en_US/fbinstant.6.2.js"></script>
<h1 id="heading1">
    This is h1.
</h1>
<button onclick="myFunction()">Move the heading</button>
<script>
    window.onload = function () {
        FBInstant.initializeAsync().then(function () {
            FBInstant.setLoadingProgress(100);
        });
        FBInstant.startGameAsync().then(function () {
            startGame();
        })
    };
</script>
<script>
    var ran = Math.floor(Math.random() * 1);
    your script codes here...
</script>
</body>
</html>

fbapp-config.json

{
  "instant_games": {
    "platform_version": "RICH_GAMEPLAY",
    "orientation": "LANDSCAPE",
    "navigation_menu_version": "NAV_FLOATING"
  }
}

fbapp-config.json must have at least these three key-value pairs for the game to start.

Tested to work successfully.

sparsh
  • 1,438
  • 1
  • 15
  • 34
  • Thanks, and do you know how to share my game with my friends? It doesn't display on their account. It shows black screen only, but I can play it – Potato23 Jan 05 '19 at 11:21
  • I have already clicked like button. I don't know why it's not displaying. – Potato23 Jan 06 '19 at 12:00
  • Your game is not playable until you submit it for the review. Once your game pass the review, then only it is visible and playable. Live or Dev mode only makes it visible for the Test users and Developers. You can set such roles access from the Roles in app settings. Try adding your friends in test users. You have not accepted and upvoted my answer yet. :) – sparsh Jan 06 '19 at 12:09
  • I upvoted . It says " Thanks for the feedback! Votes cast by those with less than 15 reputation are recorded, but do not change the publicly displayed post score." – Potato23 Jan 07 '19 at 00:01