-
Notifications
You must be signed in to change notification settings - Fork 5
General
Availability, sign-in/authentication, and server-side access - plus the shared PlayServicesResult envelope and PlayServicesError codes every other module's functions use.
Availability and authentication.
- play_services_is_available
- play_services_sign_in
- play_services_is_authenticated
- play_services_request_server_side_access
The shared result envelope used across every module.
This module includes a set of predefined constants that can be utilized for various purposes. Browse through the available constants to find values relevant to your needs and enhance the efficiency of your code.
Checks whether Google Play Services is installed and up to date on the current device. Call this before using any other function in this extension.
Syntax:
play_services_is_available()
Returns:
true if Google Play Services is available.
Example:
if (play_services_is_available())
play_services_sign_in(sign_in_callback);Manually requests that the game sign in with Play Games Services.
Note
A sign-in attempt is made automatically when the game starts. Games only need to call this manually if the automatic sign-in attempt failed, or to re-prompt after a manual sign-out.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.
Syntax:
play_services_sign_in(callback)
| Argument | Type | Description |
|---|---|---|
| callback | Function | The function to call once the sign-in attempt completes. |
Returns:
PlayServicesError.Ok if the request was accepted, PlayServicesError.ActivityNull otherwise.
Triggers:
Fires once, when the sign-in attempt completes.
| Key | Type | Description |
|---|---|---|
| status | PlayServicesResult | The sign-in request's outcome. Note status.success canbe true even when is_authenticated is false - the request itself completed, but the playerchose not to authenticate. |
| is_authenticated | Boolean | Whether the player is authenticated after this attempt. |
Example:
play_services_sign_in(function(_status, _is_authenticated)
{
if (_status.success && _is_authenticated)
show_debug_message("Signed in to Google Play Games");
});Queries Google Play Games Services for the current sign-in/authentication status.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.
Syntax:
play_services_is_authenticated(callback)
| Argument | Type | Description |
|---|---|---|
| callback | Function | The function to call once the query completes. |
Returns:
PlayServicesError.Ok if the request was accepted, PlayServicesError.ActivityNull otherwise.
Triggers:
Fires once, when the query completes.
| Key | Type | Description |
|---|---|---|
| status | PlayServicesResult | The query's outcome. |
| is_authenticated | Boolean | Whether the player is currently authenticated. |
Example:
play_services_is_authenticated(function(_status, _is_authenticated)
{
if (_status.success && !_is_authenticated)
play_services_sign_in(sign_in_callback);
});Requests server-side access to Play Games Services for the currently signed-in player -
necessary for a game backend that needs to authenticate the player independently. Returns an
authorization code your server can exchange for an access token (and, if force_refresh_token is
true, a refresh token as well).
A refresh token lets your server keep requesting new access tokens while the player isn't actively playing; refresh tokens are only issued for players who have auto sign-in enabled.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.
Syntax:
play_services_request_server_side_access(server_client_id, force_refresh_token, callback)
| Argument | Type | Description |
|---|---|---|
| server_client_id | String | The OAuth 2.0 web client ID of the server that performs the authorization code exchange. |
| force_refresh_token | Boolean | Whether to also request a refresh token when the authorization code is exchanged. |
| callback | Function | The function to call once the request completes. |
Returns:
PlayServicesError.Ok if the request was accepted, PlayServicesError.NotAuthenticated or PlayServicesError.ActivityNull otherwise.
Triggers:
Fires once, when the request completes or fails.
| Key | Type | Description |
|---|---|---|
| status | PlayServicesResult | The request's outcome. |
| auth_code | String | The authorization code, to be exchanged by your server. Only present on success. |
Example:
play_services_request_server_side_access("your-server-client-id.apps.googleusercontent.com", false,
function(_status, _auth_code = undefined)
{
if (_status.success)
{
// send _auth_code to your backend to exchange for an access token
}
});The synchronous pre-flight return code every play_services_* function reports before the
underlying Google Play Games call is ever attempted. Ok means the call was accepted and, for
functions that take a callback, that callback will fire once the real async result is known;
anything else means the callback never fires at all for that invocation.
These constants are referenced by the following functions:
- play_services_achievements_show
- play_services_achievements_increment
- play_services_achievements_reveal
- play_services_achievements_set_steps
- play_services_achievements_unlock
- play_services_achievements_get_status
- play_services_sign_in
- play_services_is_authenticated
- play_services_request_server_side_access
- play_services_player_current
- play_services_player_current_id
- play_services_player_stats_load
- play_services_player_load
- play_services_friends_load
- play_services_friends_load_more
- play_services_friends_load_with_consent
- play_services_player_profile_show
- play_services_player_search_show
- play_services_leaderboard_show_all
- play_services_leaderboard_show
- play_services_leaderboard_submit_score
- play_services_leaderboard_submit_score_with_tag
- play_services_leaderboard_load_player_centered_scores
- play_services_leaderboard_load_top_scores
- play_services_uri_to_path
- play_services_saved_games_show_saved_games_ui
- play_services_saved_games_commit_and_close
- play_services_saved_games_load
- play_services_saved_games_open
- play_services_saved_games_delete
- play_services_saved_games_resolve_conflict
| Member | Description |
|---|---|
Ok |
The call was accepted. |
NotAuthenticated |
The player is not authenticated. Call play_services_sign_in or play_services_is_authenticated first. |
ActivityNull |
The game's activity is not available yet (too early in the app lifecycle). |
InvalidArgument |
An argument was invalid for the current state (e.g. a saved-game slot name that hasn't been opened, or a friends page requested before the first page was loaded). |
Shared limits enforced by the Google Play Games Services API. Values outside these ranges are silently clamped (with a logcat warning), not rejected.
| Member | Description |
|---|---|
PLAY_SERVICES_MAX_FRIENDS_PAGE_SIZE |
(value: '25') |
PLAY_SERVICES_MAX_LEADERBOARD_RESULTS |
(value: '25') |
PLAY_SERVICES_MIN_PAGE_SIZE |
(value: '1') |
The uniform success/failure envelope delivered as the first argument to every async callback
in this extension. The real payload (if any) always rides as further, separate positional arguments
to callback.call(status, data...) - never bundled into this struct.
This struct is referenced by the following functions:
- play_services_achievements_increment
- play_services_achievements_reveal
- play_services_achievements_set_steps
- play_services_achievements_unlock
- play_services_achievements_get_status
- play_services_sign_in
- play_services_is_authenticated
- play_services_request_server_side_access
- play_services_player_current
- play_services_player_current_id
- play_services_player_stats_load
- play_services_player_load
- play_services_friends_load
- play_services_friends_load_more
- play_services_friends_load_with_consent
- play_services_player_search_show
- play_services_leaderboard_submit_score
- play_services_leaderboard_submit_score_with_tag
- play_services_leaderboard_load_player_centered_scores
- play_services_leaderboard_load_top_scores
- play_services_uri_to_path
- play_services_saved_games_show_saved_games_ui
- play_services_saved_games_commit_and_close
- play_services_saved_games_load
- play_services_saved_games_open
- play_services_saved_games_delete
- play_services_saved_games_resolve_conflict
| Member | Type | Description |
|---|---|---|
| success | Boolean | Whether the operation succeeded. |
| error | String | The error message on failure; an empty string on success. |
GameMaker 2026