Facebook

This section explains all the Facebook API functions.

Facebook is one of the most important social media on the internet and many games and developers currently have their own pages for posting games and media. GameMaker: Studio has a number of built in functions that permit you to connect with Facebook and get user information as well as post images and text to walls and a number of other things. It is recommended that you visit the Facebook Developers page before starting to use these functions as a firm understanding of how the Facebook Graph works and the available calls and permissions is essential for you to get the most from these functions.

The current graph API supported is Graph API v2.0 on all platforms.

NOTE: If your test device has the Facebook App installed, these functions will only work when creating an executable, as just testing the game (using the green or orange "play" buttons) will not work correctly. Basically, the test runner and the FaceBook App communicate with one another so the mechanism for communication has to be correctly setup, and you only get it correctly setup via the Create Application button.

Android Apps

When you set up your Facebook page to accept an Android app, you need to give the Android package name (reverse URL format and should conform to your game bundle ID), and you can set the class name to be <package_name>.RunnerActivity. GameMaker: Studio also supports Single Sign-On for Android apps, so you can enable this to allow the game to be launched from the Android Facebook app notifications. There is no need to activate Deep Linking as it is not supported by GameMaker.

There is also a section where you are required to enter the Android Keystore Hash that is unique to the keystore that you are using for your game. As this can be quite difficult to get, GameMaker: Studio can generate it for you from the Android Preferences, and you can then simply copy and paste it into the required part of the Facebook setup page.

The image below shows how your final Facebook Android section should look:

iOS Apps

The basic setup for iOS apps with the Facebook functions is the same as for Android, however there are a few key things that need to be correctly set up on the actual Facebook Developers page for your app:

Also note that the iOS Facebook SDK version is 3.16.1 which means that the minimum iOS target is version v5.0 and above.

HTML5 Apps

The HTML5 target works almost exactly the same as all previous target modules, however you cannot test the functions locally, meaning that you will have to compile and upload to your server to test. There is also one additional function that has been added to create offerwall compatibility for HTML5 games that is not available for other platforms:

  1. facebook_launch_offerwall

The functions listed below are for integrating your game with Facebook:

  1. facebook_init
  2. facebook_login
  3. facebook_request_publish_permissions
  4. facebook_request_read_permissions
  5. facebook_check_permission
  6. facebook_status
  7. facebook_accesstoken
  8. facebook_user_id
  9. facebook_graph_request
  10. facebook_dialog
  11. facebook_send_invite
  12. facebook_post_message
  13. facebook_logout

NOTE: You must have activated the Facebook API in the Global Game Settings for the target platform and called the facebook_init() function before any of these functions can be used correctly.

Troubleshooting

There are a few things to note when working with Facebook, and these are listed below:



Back: Social Gaming
© Copyright YoYo Games Ltd. 2018 All Rights Reserved