Friends

Invite Friends

Prerequisite: make sure you integrate the Game API and it’s loading correctly before continuing (see Load the API).

When a user is playing in a Spil Portal the game is able to trigger the invite friends pop up. If the game is running outside of Spil Portal environment the method behaves as an empty function. The pop up will only display if the user is logged in.

Retrieve friends data

Before requesting friends data you should check for the service availability. This will indicate if GameAPI is able to retrieve the data in the current context where it is running. The method will not return data when the property is set to false.

You are able to retrieve a user’s friend list data from the GameAPI.Friends.getFriends method.

The returned data is an array where each element has the following format: