404
+ +Page not found
+ + +Page not found
+ + +YoYoGames 2024
+ +This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.
+++This function was deprecated with version 1.3.0.
+
Initializes the target identifier for app open ads functions.
+Note
+Please refer to AdMob_AppOpenAd_Set_AdUnit for more information.
+Syntax:
++++AdMob_AppOpenAd_Init(adUnitId)
Argument | +Type | +Description | +
---|---|---|
adUnitId | +String | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was deprecated.Set the target identifier for app open ads functions, app open ads funcitons doesn't allow multiple pre-loaded identifiers.
+Syntax:
++++AdMob_AppOpenAd_Set_AdUnit(adUnitId)
Argument | +Type | +Description | +
---|---|---|
adUnitId | +String | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.Enable show App Open Ads when game resumes from background.
+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 Social Async Event.
+Syntax:
++++AdMob_AppOpenAd_Enable(orientation)
Argument | +Type | +Description | +
---|---|---|
orientation | +Real | ++ |
Returns:
++ ++
Triggers:
++ ++
This event is triggered when the ad view is closed by the user.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_AppOpenAd_OnDismissed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This event is triggered is the awaited task fails.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_AppOpenAd_OnShowFailed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
This event is triggered is the awaited task succeeds.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_AppOpenAd_OnFullyShown" |
+
unit_id | +String | +Unit identifier of the advertisment | +
Versioning:
+1.3.0
- This function was introduced.Disable show App Open Ads when game resume
+Syntax:
++++AdMob_AppOpenAd_Disable()
Returns:
++ ++
Versioning:
+1.3.0
- This function was introduced.Return the true if app open ads are enabled. Otherwise return false.
+Syntax:
++++AdMob_AppOpenAd_IsEnabled()
Returns:
++ ++
This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.
+++This function was deprecated with version 1.3.0.
+
Initializes the target identifier for banner functions.
+Note
+Please refer to AdMob_Banner_Set_AdUnit for more information.
+Syntax:
++++AdMob_Banner_Init(adUnitId)
Argument | +Type | +Description | +
---|---|---|
adUnitId | +String | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was deprecated.Set the target identifier for banner functions, Banner funcitons DOESN'T allow multiple preloaded identifiers.
+Syntax:
++++AdMob_Banner_Set_AdUnit(adUnitId)
Argument | +Type | +Description | +
---|---|---|
adUnitId | +String | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.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 Social Async Event.
+Syntax:
++++AdMob_Banner_Create(size, bottom)
Argument | +Type | +Description | +
---|---|---|
size | +Real | +The type of the banner to be displayed. | +
bottom | +Boolean | +Whether the banner should be placed at the bottom of the display. | +
Returns:
++ ++
Triggers:
++ ++
This event is triggered is the awaited task succeeds.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Banner_OnLoaded" |
+
This event is triggered is the awaited task fails.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Banner_OnLoadFailed" |
+
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
This function can be used to get the width of the currently loaded banner ad block. The value returned is in pixels. NOTE: This function returns the width in screen pixels, it’s up to the developer to convert the value to the correct scale according to the render target being used.
+Syntax:
++++AdMob_Banner_GetWidth()
Returns:
++ ++
This function can be used to get the height of the currently loaded banner ad block. The value returned is in pixels. NOTE: This function returns the height in screen pixels, it’s up to the developer to convert the value to the correct scale according to the render target being used.
+Syntax:
++++AdMob_Banner_GetHeight()
Returns:
++ ++
This function can be used to move a banner that has been previously added. You supply a boolean that will determine if the banner should be placed at the bottom or at the top of the display.
+Syntax:
++++AdMob_Banner_Move(bottom)
Argument | +Type | +Description | +
---|---|---|
bottom | +Boolean | +Whether the banner should be placed at the bottom of the display. | +
Returns:
++ ++
This function can be used to show the currently active, but hidden, banner ad block. When called, the banner will be shown to the user again and will be able to receive input. You can hide the banner again at any time using the AdMob_Banner_Hide function.
+Syntax:
++++AdMob_Banner_Show()
Returns:
++ ++
This function can be used to hide the currently active banner ad block. When called, the banner will be removed from the user’s view and will no longer receive input. You can show the banner again at any time using the AdMob_Banner_Show function.
+Syntax:
++++AdMob_Banner_Hide()
Returns:
++ ++
This function will remove the currently active banner from the app. If you call this function then want to show ads again, you must call the AdMob_Banner_Create function first to add a new banner to the display.
+Syntax:
++++AdMob_Banner_Remove()
Returns:
++ ++
This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.
+Requests a consent information update (this needs to be called prior to AdMob_Consent_Load)
+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 Social Async Event.
+Syntax:
++++AdMob_Consent_RequestInfoUpdate(mode)
Argument | +Type | +Description | +
---|---|---|
mode | +AdMobConsentMode | ++ |
Returns:
+++N/A
+
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Consent_OnRequestInfoUpdated" |
+
Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Consent_OnRequestInfoUpdateFailed" |
+
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
Allows to set the mode of the consent request being used. This function allows you to debug different regions and EEA and NON-EEA and should be passed in as a 'AdMob_Consent_Mode_*' constant. This function should be called before AdMob_Consent_GetStatus and AdMob_Consent_GetType in order to get the correct output from both functions.
+++Requires a previous call to AdMob_Consent_RequestInfoUpdate
+
Syntax:
++++AdMob_Consent_GetStatus()
Returns:
++ ++
Returns the answer given by the user to a previous GDPR consent request.
+Syntax:
++++AdMob_Consent_GetType()
Returns:
++ ++
Checks whether or not the GDPR consent form is available on this device.
+Syntax:
++++AdMob_Consent_IsFormAvailable()
Returns:
+++N/A
+
Loads the consent form into memory so it can be displayed to the user. If you do not call this function before trying to show the GDPR consent, nothing will be shown.
+++Requires a previous call to AdMob_Consent_RequestInfoUpdate
+
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 Social Async Event.
+Syntax:
++++AdMob_Consent_Load()
Returns:
+++N/A
+
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Consent_OnLoaded" |
+
Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Consent_OnLoadFailed" |
+
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
Shows the consent form to the user. If you do not call the AdMob_Consent_Load function before trying to show the GDPR consent, nothing will be shown.
+++Requires a previous call to AdMob_Consent_Load
+
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 Social Async Event.
+Syntax:
++++AdMob_Consent_Show()
Returns:
+++N/A
+
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Consent_OnShown" |
+
Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Consent_OnShowFailed" |
+
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
This function resets the consent status flag.
+Syntax:
++++AdMob_Consent_Reset()
Returns:
+++N/A
+
The following are the available constanst to use with the AdMob API.
+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.
+These set of constants represent the values errors values that can return from the AdMob function calls.
+These constants are referenced by the following functions:
+Member | +Description | +
---|---|
ADMOB_OK |
+There were no errors. | +
ADMOB_ERROR_NOT_INITIALIZED |
+The AdMob extension needs to be initialized prior to this call | +
ADMOB_ERROR_INVALID_AD_ID |
+The provided ad unit id is not valid. | +
ADMOB_ERROR_AD_LIMIT_REACHED |
+The limit of loaded ads for this specific type was reached. | +
ADMOB_ERROR_NO_ADS_LOADED |
+There are no loaded ads to be shown for this specific type. | +
ADMOB_ERROR_NO_ACTIVE_BANNER_AD |
+There is no active banner ad. | +
ADMOB_ERROR_ILLEGAL_CALL |
+The call you are trying to execute is illegal (used for functions that need to be called prior to initialization). | +
These set of constants represent precision type of the reported ad value.
+These constants are referenced by the following functions:
+ +Member | +Description | +
---|---|
ADMOB_ADVALUE_PRECISION_UNKNOWN |
+An unknown precision type. | +
ADMOB_ADVALUE_PRECISION_ESTIMATED |
+An ad value estimated from aggregated data. | +
ADMOB_ADVALUE_PRECISION_PRECISE |
+The precise value paid for this ad. | +
ADMOB_ADVALUE_PRECISION_PUBLISHER_PROVIDED |
+A publisher-provided ad value, such as manual CPMs in a mediation group. | +
These set of constants represent the various types of available banners.
+Member | +Description | +
---|---|
AdMob_Banner_NORMAL |
+Normal sized banner (320x50 dp) | +
AdMob_Banner_LARGE |
+Large sized banner (320x100 dp) | +
AdMob_Banner_MEDIUM |
+IAB medium rectangle (300x250 dp) | +
AdMob_Banner_FULL |
+IAB full-size banner (468x60 dp - tablets only) | +
AdMob_Banner_LEADERBOARD |
+IAB leaderboard (728x90 dp - tablets only) | +
AdMob_Banner_SMART |
+A dynamic size banner (deprecated, see AdMob_Banner_ADAPTIVE ) |
+
AdMob_Banner_ADAPTIVE |
+A dynamically sized banner | +
These set of constants represent the various types of possible content ratings for ads.
+These constants are referenced by the following functions:
+ +Member | +Description | +
---|---|
AdMob_ContentRating_GENERAL |
+Content suitable for general audiences. | +
AdMob_ContentRating_PARENTAL_GUIDANCE |
+Content suitable for most audiences with parental guidance. | +
AdMob_ContentRating_TEEN |
+Content suitable for teen and older audiences. | +
AdMob_ContentRating_MATURE_AUDIENCE |
+Content suitable only for mature audiences. | +
These set of constants represent the various consent status.
+These constants are referenced by the following functions:
+ +Member | +Description | +
---|---|
AdMob_Consent_Status_UNKNOWN |
+Consent status is unknown. | +
AdMob_Consent_Status_NOT_REQUIRED |
+User consent not required. | +
AdMob_Consent_Status_REQUIRED |
+User consent required but not yet obtained. | +
AdMob_Consent_Status_OBTAINED |
+User consent obtained. Personalized vs non-personalized undefined. | +
These set of constants represent the given consent type.
+These constants are referenced by the following functions:
+ +Member | +Description | +
---|---|
AdMob_Consent_Type_UNKNOWN |
+Consent type is unknown (before consent was requested). | +
AdMob_Consent_Type_NON_PERSONALIZED |
+Consent was given for non-personalized ads. | +
AdMob_Consent_Type_PERSONALIZED |
+Consent was given for personalized ads. | +
AdMob_Consent_Type_DECLINED |
+Consent was declined for any kind of ads. | +
These set of constants represent the consent mode (these are used for testing porpuses).
+These constants are referenced by the following functions:
+ +Member | +Description | +
---|---|
AdMob_Consent_Mode_DEBUG_GEOGRAPHY_DISABLED |
+Debug geography disabled. | +
AdMob_Consent_Mode_DEBUG_GEOGRAPHY_EEA |
+Geography appears as in EEA for debug devices. | +
AdMob_Consent_Mode_DEBUG_GEOGRAPHY_NOT_EEA |
+Geography appears as not in EEA for debug devices. | +
AdMob_Consent_Mode_PRODUCTION |
+Same as AdMob_Consent_Mode_DEBUG_GEOGRAPHY_DISABLED , used for production. |
+
This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.
+ +This function initializes the Google AdMob API and should be called at the start of your game.
+Syntax:
++++AdMob_Initialize()
Returns:
+++N/A
+
This function tells the app to use test ads instead of “live” ads, essential for testing whether your ads work without generating potentially fraudulent click-throughs. This function should be called BEFORE calling AdMob_Initialize.
+Syntax:
++++AdMob_SetTestDeviceId()
Returns:
+++N/A
+
Enable the paid load callbacks, NOTE: You should enable this feature in your console too https://support.google.com/admob/answer/11322405
+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 Social Async Event.
+Syntax:
++++AdMob_Events_OnPaidEvent(enable)
Argument | +Type | +Description | +
---|---|---|
enable | +Real | ++ |
Returns:
+++N/A
+
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_OnPaidEvent" |
+
mediation_adapter_class_name | +String | +The mediation adapter class name of the ad network that loaded the ad. | +
unit_id | +String | +identifier of the ad | +
ad_type | +String | +'Banner","Interstitial","Rewarded","RewardedInterstitial" or "AppOpen" | +
micros | +Real | +The ad's value in micro-units, where 1,000,000 micro-units equal one unit of the currency. | +
currency_code | +String | +The value's ISO 4217 currency code. | +
precision | +AdMobAdValuePrecision | +The precision type of the reported ad value. | +
ad_source_name | +String | +Gets the ad source representing the specific ad network that serves the impression. For campaigns, Mediated House Ads is returned for a mediated ads campaign goal type, and Reservation Campaign is returned for impression and click goal types. See Ad sources for the list of possible ad source names when an ad network serves the ad. | +
ad_source_id | +String | +Gets the ad source ID associated with this adapter response. For campaigns, 6060308706800320801 is returned for a mediated ads campaign goal type, and 7068401028668408324 is returned for impression and click goal types. See Ad sources for the list of possible ad source IDs when an ad network serves the ad. | +
ad_source_instance_name | +String | +Gets the ad source instance name associated with this adapter response. | +
ad_source_instance_id | +String | +Gets the ad source instance ID associated with this adapter response. | +
This is the AdMob extension which provides functionality to developers to add Google Ads to their game. In this wiki you can find the full available API documentation and guides necessary to get started.
+Before you start using this extension make sure to follow our Setup guide. Which will get you up and running.
+To get started using this extension, follow the Quick Start Guide.
+For the recommended workflow see the Workflow page.
+The following are the available modules from the AdMob API:
+For full documentation visit mkdocs.org.
+mkdocs new [dir-name]
- Create a new project.mkdocs serve
- Start the live-reloading docs server.mkdocs build
- Build the documentation site.mkdocs -h
- Print help message and exit.mkdocs.yml # The configuration file.
+docs/
+ index.md # The documentation homepage.
+ ... # Other markdown pages, images and other files.
+
+
+ This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.
+++This function was deprecated with version 1.3.0.
+
Initializes the target identifier for interstitial ad functions.
+Note
+Please refer to AdMob_Interstitial_Set_AdUnit for more information.
+Syntax:
++++AdMob_Interstitial_Init(adUnitId)
Argument | +Type | +Description | +
---|---|---|
adUnitId | +String | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was deprecated.Set the target identifier for interstitial functions, Interstitials functions allow multiple identifiers
+Syntax:
++++AdMob_Interstitial_Set_AdUnit(adUnitId)
Argument | +Type | +Description | +
---|---|---|
adUnitId | +String | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.Release Interstitial load instances (passing -1 will free all the loaded instances).
+Syntax:
++++Admob_Interstitial_Free_Load_Instances(count)
Argument | +Type | +Description | +
---|---|---|
count | +Real | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.Set the max number of Interstitial load instances, this allow present consecutiva ads. Default value is 1.
+Syntax:
++++Admob_Interstitial_Max_Instances(count)
Argument | +Type | +Description | +
---|---|---|
count | +Real | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.This function should be called when you want to load an interstitial ad. Calling it will send a request to the ad server to provide an interstitial ad, which will then be loaded into the app for display. This function does not show the ad, just stores it in memory ready for being shown. If you do not call this function before trying to show an ad, nothing will be shown. Note that you can check whether an interstitial is loaded or not using the function AdMob_Interstitial_IsLoaded.
+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 Social Async Event.
+Syntax:
++++AdMob_Interstitial_Load()
Returns:
++ ++
Triggers:
++ ++
This event is triggered is the awaited task succeeds.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Interstitial_OnLoaded" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This event is triggered is the awaited task fails.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Interstitial_OnLoadFailed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
This function will show the interstitial ad, if one is available and loaded. You can check whether an ad is available using the function AdMob_Interstitial_IsLoaded. Note that while an interstitial is being shown, your app will be put into the background and will effectively be “paused”.
+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 Social Async Event.
+Syntax:
++++AdMob_Interstitial_Show()
Returns:
++ ++
Triggers:
++ ++
This event is triggered is the ad view is closed by the user.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Interstitial_OnDismissed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This event is triggered is the awaited task fails.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Interstitial_OnShowFailed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
This event is triggered is the awaited task succeeds.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_Interstitial_OnFullyShown" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This function will return whether or not the interstitial ad is loaded.
+Syntax:
++++AdMob_Interstitial_IsLoaded()
Returns:
++ ++
Return the number of Interstitial load instances are ready.
+Syntax:
++++AdMob_Interstitial_Instances_Count()
Returns:
++ ++
Versioning:
+1.3.0
- This function was introduced.This section aims to deliver an easy and simple set of examples that should help you migrate your project from a previous version of the AdMob extension into this new, updated version. The first thing to notice is that all previously named “GoogleMobileAds_*” functions have been renamed to “AdMob_*” providing a more compact naming convention which is consistent with the Google API function names outside the GameMaker environment.
+The first thing to look for when creating an AdMob GameMaker project is initializing your API.
+// On the previous version you would need to provide application id and
+// an interstitial id to the API initialization function.
+GoogleMobileAds_Init(interstitialId, applicationId);
+
+// Optionally you could set your device to test mode to use test ads instead
+// of ‘live’ ones. You would provide the enable flag and the device id.
+GoogleMobileAds_UseTestAds(enable, deviceId); // <----- this is OPTIONAL
+// If you are using Test Ads the ‘AdMob_SetTestDeviceId’ function needs to be
+// called BEFORE initialization (no arguments are required).
+AdMob_SetTestDeviceId(); // <----- this is OPTIONAL (development only)
+
+// In the new version you just need to call the initialization method without
+// any arguments, as the extension now gets the application id from the
+// “extension options” automatically (Setup, 2.), and the ad ids are setup on
+// a per ad-type basis.
+AdMob_Initialize();
+One of the first concepts requiring your attention when setting up a project using AdMob is that, depending on the user's geographic location, you might need to ask for permission to use their personal information to personalize the ads that are shown.
+In previous versions you could ask the user for their consent to collect data for personalized ads using one of the following setups:
+// You could forcefully show the consent form providing a privacy URL and
+// options for personalized ads, non-personalized ads and ad-free version of
+// your game.
+GoogleMobileAds_ConsentFormShow(privacyPolicy, personalized, nonPersonalized, adFree);
+OR
+// You could show the consent form ONLY if the user hasn’t yet answered it.
+GoogleMobileAds_ConsentUpdate(publisherId, privacyPolicy, personalized, nonPersonalized, adFree);
+The new version has added functionality that requires you to:
+The first steps towards requesting user consent are the following:
+// First of all we need to set the Consent Mode, which can be used for
+// debugging purposes to run tests as a user in a different geographic area;
+// more info: Consent Mode. This function will generate an ASYNC SOCIAL EVENT.
+AdMob_Consent_RequestInfoUpdate(AdMob_Consent_Mode_PRODUCTION);
+After setting the consent mode we need to add some code to the ASYNC SOCIAL EVENT, to check for the events generated by the AdMob_Consent_RequestInfoUpdate function call. +Here is what each event allows us to do:
+Given below is the fully documented template code that you can use in your ASYNC SOCIAL EVENT:
+// Early exit if there is no 'type' key defined
+if (!ds_map_exists(async_load, "type")) exit;
+
+// All the events triggered by the AdMob extension have a “type” key
+// containing a string that starts with “AdMob_”.
+switch(async_load[? "type"])
+{
+ // AdMob_Consent_RequestInfoUpdate() succeeded
+ case "AdMob_Consent_OnRequestInfoUpdated":
+
+ // Now we need to get the consent Status, this will tell us if we
+ // are required to ask the user for GDPR consent.
+ if (AdMob_Consent_GetStatus() == AdMob_Consent_Status_REQUIRED)
+
+ // Since we are REQUIRED, we now need to load the consent
+ // form before we can show it. For this we use the function
+ // below (more info: AdMob_Consent_Load). This function call
+ // will also generate an ASYNC SOCIAL EVENT.
+ AdMob_Consent_Load();
+ break;
+
+ // AdMob_Consent_RequestInfoUpdate() failed
+ case "AdMob_Consent_OnRequestInfoUpdateFailed":
+
+ // This means there was a problem while setting the consent
+ // mode. Here we can add some code to deal with it.
+ break;
+
+ // AdMob_Consent_Load() succeeded
+ case "AdMob_Consent_OnLoaded":
+
+ // We have successfully loaded the consent form and we are now
+ // ready to show it to the user (more info: AdMob_Consent_Show)
+ AdMob_Consent_Show();
+ break;
+
+ // AdMob_Consent_Load() failed
+ case "AdMob_Consent_OnLoadFailed":
+
+ // This means there was a problem while loading the consent
+ // form. Here we can add some code to deal with it.
+ break;
+
+ // AdMob_Consent_Show() succeeded and the user already answered it
+ case "AdMob_Consent_OnShown":
+
+ // At this point we now have the consent information from the
+ // user. We can use both the GetStatus and GetType functions to
+ // get the obtained information (more info:
+ // AdMob_Consent_GetStatus and AdMob_Consent_GetType)
+ global.ConsentStatus = AdMob_Consent_GetStatus();
+ global.ConsentType = AdMob_Consent_GetType();
+ break;
+}
+This new version of the AdMob extension allows the developer to target ads to a specific audience. This could already be done in previous versions but the new version now has more features specifically for targeting.
+In previous versions the developer could mark a user as underage ads using the following function:
+// The function below classifies users as under age and only non-personalised
+// ads can be shown, regardless of any other setting, and the consent form
+// will not be shown.
+GoogleMobileAds_ConsentSetUserUnderAge(true);
+In the new version of the extension the developer is presented with more features that will help target the right kind of ads to the right kind of audience:
+// The function below allows the developer to enable or disable ads for
+// under-age users (much like the old version). Note that it is up to the
+// developer to identify the age of the consumer.
+AdMob_Targeting_UnderAge(true);
+
+// The function below allows the developer to enable or disable ads for
+// children. Note that it is up to the developer to identify the age of the
+// consumer.
+AdMob_Targeting_COPPA(true);
+
+// The new version of the AdMob extension allows for even further control
+// over the filtering of the ads being displayed to the user. The function
+// below allows the developer to set a maximum content rating of the ads to be
+// displayed (info: AdMob_Targeting_MaxAdContentRating and Content Rating constant.
+AdMob_Targeting_MaxAdContentRating(AdMob_ContentRating_GENERAL);
+There have been a lot of API changes since the previous version, that said let’s jump in on a quick set up for adding banner ads to your application.
+Even though not all old functions map perfectly into the new API the following list should get you started with some of the changes (check the section below for more details):
+The first step we should take towards adding banners is to use a manager object with the following CREATE EVENT (remember that you need to initialize the API first - Initialization)
+// After API initialization we can proceed to initialize the banner options.
+// This function requires a unique ad block id string that can be obtained
+// from the google developer console (more info: AdMob_Banner_Init).
+// This function will generate an ASYNC SOCIAL EVENT.
+var banner_id = "ca-app-pub-3940256099942544/6300978111"
+AdMob_Banner_Init(banner_id);
+The second step requires us to make sure the API was initialized, so for this example we will use the ASYNC SOCIAL EVENT to check for the events generated by the AdMob_Initialize function call.
+// Early exit if there is no 'type' key defined
+if (!ds_map_exists(async_load, "type")) exit;
+
+// All the events triggered by the AdMob extension have a “type” key
+// containing a string that starts with “AdMob_”.
+switch(async_load[? "type"])
+{
+ // AdMob_Initialize() finished initializing the API
+ case "AdMob_OnInitialized":
+
+ // Now that we are sure that the API was initialized we can create
+ // our new banner on the device display.
+
+ // The function below will create a new banner of a given type,
+ // allowing the developer to also select the position of the
+ // banner (this can be either at the top or the bottom of the
+ // screen (more info: AdMob_Banner_Create and Banner Type).
+ var banner_type = AdMob_Banner_ADAPTIVE;
+ var bottom = true;
+ AdMob_Banner_Create(banner_type, bottom)
+ break;
+
+ // AdMob_Banner_Create() succeeded
+ case "AdMob_Banner_OnLoaded":
+
+ // At this point we should now have a banner on the screen.
+ break;
+
+ // AdMob_Banner_Create() failed
+ case "AdMob_Banner_OnLoadFailed":
+
+ // At this point there was a problem while creating the banner.
+ // Here we can add some code to deal with it.
+
+ // NOTE: Don’t try to create a banner here because it can lead to
+ // an infinite loop if the banner creation fails constantly.
+ break;
+}
+Interstitial ads are ads that will fill up the entire screen and need to be dismissed in order for the application to continue execution. Initial setup for interstitials is very similar to Banner ads (more info: Banner Ads). Let’s look at some code to quickly set up interstitial ads for your application.
+Even though not all old functions map perfectly into the new API, the following list should get you started with some of the changes (check the section below for more details):
+The first step we should take towards adding interstitials is to use a manager object with the following CREATE EVENT (remember that you need to initialize the API first - Initialization)
+// After API initialization we can proceed to initialize the interstitial
+// options. This requires a unique ad block id string that can be obtained
+// from the google developer console. (more info: AdMob_Interstitial_Init).
+// This function will generate a SOCIAL ASYNC EVENT.
+var interstitial_id = "ca-app-pub-3940256099942544/1033173712"
+AdMob_Interstitial_Init(interstitial_id);
+The second step requires us to make sure the API was initialized so for this example we will use the ASYNC SOCIAL EVENT, to check for the events generated by the AdMob_Initialize function call.
+// Early exit if there is no 'type' key defined
+if (!ds_map_exists(async_load, "type")) exit;
+
+// All the events triggered by the AdMob extension have a “type” key
+// containing a string that starts with “AdMob_”.
+switch(async_load[? "type"])
+{
+ // AdMob_Initialize() finished initializing the API
+ case "AdMob_OnInitialized":
+
+ // Now that we are sure that the API got initialized we can load
+ // a new interstitial ad.(more info: AdMob_Interstitial_Load).
+ // This function will generate an ASYNC SOCIAL EVENT.
+ AdMob_Interstitial_Load();
+ break;
+
+ // AdMob_Interstitial_Load() succeeded
+ case "AdMob_Interstitial_OnLoaded":
+
+ // At this point we should now have the interstitial ad loaded and
+ // and we can check that using the ´AdMob_Interstitial_IsLoaded´
+ // function. We are now ready to show the interstitial ad to the
+ // user (more info: AdMob_Interstitial_Show). This function will
+ // generate an ASYNC SOCIAL EVENT.
+ AdMob_Interstitial_Show();
+ break;
+
+ // AdMob_Interstitial_Load() failed
+ case "AdMob_Interstitial_OnLoadFailed":
+
+ // At this point there was a problem while loading the
+ // interstitial ad. Here we can add some code to deal with it.
+
+ // NOTE: Don’t try to reload the interstitial ad here because
+ // it can lead to an infinite loop.
+ break;
+
+ // AdMob_Interstitial_Show() succeeded
+ case "AdMob_Interstitial_OnFullyShown":
+
+ // At this point the interstitial ad is on screen and the user is
+ // looking at it. Note that at this point in time your game is
+ // paused and will remain paused until the interstitial gets
+ // dismissed.
+ break;
+
+ // AdMob_Interstitial_Show() failed
+ case "AdMob_Interstitial_OnShowFailed":
+
+ // At this point the interstitial ad failed to get shown to the
+ // user. You can add code to deal with the problem here.
+
+ // NOTE: Don’t try to reload/show the interstitial ad here
+ // because it can lead to an infinite loop.
+ break;
+
+ // Interstitial got dismissed
+ case "AdMob_Interstitial_OnDismissed":
+
+ // At this point the interstitial ad got dismissed by the user and
+ // the game logic is running again.
+ break;
+
+}
+Rewarded video ads are ads that will fill up the entire screen and play a video, at the end of which the user can be rewarded in some way, and similar to interstitial ads they also need to be dismissed in order for the application to continue execution. Rewarded Video ads setup is very similar to other previous ads (more info: Banner Ads and Interstitial Ads). Let’s look at some code to quickly set up rewarded video ads on your application.
+Even though not all old functions map perfectly into the new API the following list should get you started with some of the changes (check the section below for more details):
+The first step we should take towards adding rewarded videos is to use a manager object with the following CREATE EVENT (remember that you need to initialize the API first - Initialization)
+// After API initialization we can proceed to initialize the rewarded video
+// options. This requires an unique ad block id string that can be obtained
+// from the google developer console. (more info: AdMob_RewardedVideo_Init).
+// This function will generate an ASYNC SOCIAL EVENT.
+var rewarded_id = "ca-app-pub-3940256099942544/1033173712"
+AdMob_RewardedVideo_Init(rewarded_id);
+The second step requires us to make sure the API was initialized. For this example we will use the ASYNC SOCIAL EVENT, to check for the events generated by the AdMob_Initialize function call.
+// Early exit if there is no 'type' key defined
+if (!ds_map_exists(async_load, "type")) exit;
+
+// All the events triggered by the AdMob extension have a “type” key
+// containing a string that starts with “AdMob_”.
+switch(async_load[? "type"])
+{
+ // AdMob_Initialize() finished initializing the API
+ case "AdMob_OnInitialized":
+
+ // Now that we are sure that the API got initialized we can load
+ // a new rewarded video ad.(more info: AdMob_RewardedVideo_Load).
+ // This function will generate an ASYNC SOCIAL EVENT.
+ AdMob_RewardedVideo_Load();
+ break;
+
+ // AdMob_RewardedVideo_Load() succeeded
+ case "AdMob_RewardedVideo_OnLoaded":
+
+ // At this point we should now have the rewarded ad loaded and
+ // and we can check that using the ´AdMob_RewardedVideo_IsLoaded´
+ // function. We are now ready to show the rewarded video ad to the
+ // user (more info: AdMob_RewardedVideo_Show). This function will
+ // generate an ASYNC SOCIAL EVENT.
+ AdMob_RewardedVideo_Show();
+ break;
+
+ // AdMob_RewardedVideo_Load() failed
+ case "AdMob_RewardedVideo_OnLoadFailed":
+
+ // At this point there was a problem while loading the
+ // interstitial ad. Here we can add some code to deal with it.
+
+ // NOTE: Don’t try to reload the interstitial ad here because
+ // it can lead to an infinite loop.
+ break;
+
+ // AdMob_RewardedVideo_Show() succeeded
+ case "AdMob_RewardedVideo_OnFullyShown":
+
+ // At this point the rewarded video ad is playing and the user is
+ // looking at it. Note that at this point in time your game is
+ // paused and will remain paused until the rewarded video ad gets
+ // dismissed.
+ break;
+
+ // AdMob_RewardedVideo_Show() failed
+ case "AdMob_RewardedVideo_OnShowFailed":
+
+ // At this point the rewarded video ad failed to get shown to the
+ // user. You can add code to deal with the problem here.
+
+ // NOTE: Don’t try to reload/show the rewarded video here
+ // because it can lead to an infinite loop.
+ break;
+
+ // RewardedVideo got dismissed
+ case "AdMob_RewardedVideo_OnDismissed":
+
+ // At this point the rewarded video ad got dismissed by the user
+ // and the game logic is running again.
+ break;
+
+ // RewardedVideo triggered the reward event
+ case "AdMob_RewardedVideo_OnReward":
+
+ // At this point the user watched enough of the rewarded video and
+ // can be rewarded for it. Here we can add the reward code.
+ show_debug_message("You got 1000 points");
+ break;
+
+}
+Rewarded interstitial is a type of incentivized ad format that allows you offer rewards for ads that appear automatically during natural app transitions. Unlike rewarded ads, users aren't required to opt-in to view a rewarded interstitial, and similar to interstitial ads they also need to be dismissed in order for the application to continue execution. Rewarded interstitial ads setup is very similar to other previous ads (more info: Banner Ads and Interstitial Ads). Let’s look at some code to quickly set up rewarded interstitial ads on your application.
+Even though not all old functions map perfectly into the new API the following list should get you started with some of the changes (check the section below for more details):
+The first step we should take towards adding rewarded interstitial is to use a manager object with the following CREATE EVENT (remember that you need to initialize the API first - Initialization)
+// After API initialization we can proceed to initialize the rewarded
+// interstitial options. This requires an unique ad block id string that can
+// be obtained from the google developer console. (more info:
+// AdMob_RewardedInterstitial_Init).
+// This function will generate an ASYNC SOCIAL EVENT.
+var rewarded_interstitial_id = "ca-app-pub-3940256099942544/5354046379"
+AdMob_RewardedVideo_Init(rewarded_interstitial_id);
+The second step requires us to make sure the API was initialized. For this example we will use the ASYNC SOCIAL EVENT, to check for the events generated by the AdMob_Initialize function call.
+// Early exit if there is no 'type' key defined
+if (!ds_map_exists(async_load, "type")) exit;
+
+// All the events triggered by the AdMob extension have a “type” key
+// containing a string that starts with “AdMob_”.
+switch(async_load[? "type"])
+{
+ // AdMob_Initialize() finished initializing the API
+ case "AdMob_OnInitialized":
+
+ // Now that we are sure that the API got initialized we can load
+ // a new rewarded interstitial ad.
+ // (more info: AdMob_RewardedInterstitial_Load).
+ // This function will generate an ASYNC SOCIAL EVENT.
+ AdMob_RewardedInterstitial_Load();
+ break;
+
+ // AdMob_RewardedInterstitial_Load() succeeded
+ case "AdMob_RewardedInterstitial_OnLoaded":
+
+ // At this point we should now have the rewarded ad loaded and
+ // and we can check that using the
+ // ´AdMob_RewardedInterstitial_IsLoaded´ function. We are now
+ // ready to show the rewarded interstitial ad to the user
+ // (more info: AdMob_RewardedInterstitial_Show).
+ // This function will generate an ASYNC SOCIAL EVENT.
+ AdMob_RewardedInterstitial_Show();
+ break;
+
+ // AdMob_RewardedInterstitial_Load() failed
+ case "AdMob_RewardedInterstitial_OnLoadFailed":
+
+ // At this point there was a problem while loading the
+ // interstitial ad. Here we can add some code to deal with it.
+
+ // NOTE: Don’t try to reload the interstitial ad here because
+ // it can lead to an infinite loop.
+ break;
+
+ // AdMob_RewardedInterstitial_Show() succeeded
+ case "AdMob_RewardedInterstitial_OnFullyShown":
+
+ // At this point the rewarded video ad is playing and the user is
+ // looking at it. Note that at this point in time your game is
+ // paused and will remain paused until the rewarded video ad gets
+ // dismissed.
+ break;
+
+ // AdMob_RewardedInterstitial_Show() failed
+ case "AdMob_RewardedInterstitial_OnShowFailed":
+
+ // At this point the rewarded video ad failed to get shown to the
+ // user. You can add code to deal with the problem here.
+
+ // NOTE: Don’t try to reload/show the rewarded video here
+ // because it can lead to an infinite loop.
+ break;
+
+ // RewardedInterstitial got dismissed
+ case "AdMob_RewardedInterstitial_OnDismissed":
+
+ // At this point the rewarded interstitial ad got dismissed by the
+ // user and the game logic is running again.
+ break;
+
+ // RewardedInterstitial triggered the reward event
+ case "AdMob_RewardedInterstitial_OnReward":
+
+ // At this point the user watched enough of the rewarded video and
+ // can be rewarded for it. Here we can add the reward code.
+ show_debug_message("You got 1000 points");
+ break;
+
+}
+
+ This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.
+++This function was deprecated with version 1.3.0.
+
Initializes the target identifier for rewarded interstitial ad functions.
+Note
+Please refer to AdMob_RewardedInterstitial_Set_AdUnit for more information.
+Syntax:
++++AdMob_RewardedInterstitial_Init(adUnitId)
Argument | +Type | +Description | +
---|---|---|
adUnitId | +String | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was deprecated.Set the target identifier for rewarded interstitial functions, Rewarded interstitial funcitons allow multiple identifiers
+Syntax:
++++AdMob_RewardedInterstitial_Set_AdUnit(adUnitId)
Argument | +Type | +Description | +
---|---|---|
adUnitId | +String | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.Release Rewarded Interstitial load instances (passing -1 will free all the loaded instances).
+Syntax:
++++AdMob_RewardedInterstitial_Free_Load_Instances(count)
Argument | +Type | +Description | +
---|---|---|
count | +Real | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.Set the max number of Rewarded Insterstitials load instances, this allow present consecutiva ads. Default value is 1.
+Syntax:
++++AdMob_RewardedInterstitial_Max_Instances(count)
Argument | +Type | +Description | +
---|---|---|
count | +Real | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.This function should be called when you want to load a rewarded interstitial ad. Calling it will send a request to the ad server to provide a rewarded ad, which will then be loaded into the app for display. This function does not show the ad, just stores it in memory ready for showing. If you do not call this function before trying to show an ad, nothing will be shown. Note that you can check whether a rewarded interstitial is loaded or not using the function AdMob_RewardedInterstitial_IsLoaded.
+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 Social Async Event.
+Syntax:
++++AdMob_RewardedInterstitial_Load()
Returns:
++ ++
Triggers:
++ ++
This event is triggered is the awaited task fails.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedInterstitial_OnLoadFailed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
This event is triggered is the awaited task succeeds.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedInterstitial_OnLoaded" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This function will show the rewarded video ad, if one is available and loaded. You can check whether an ad has previously been loaded using the function AdMob_RewardedInterstitial_IsLoaded. Note that while a rewarded interstitial ad is being shown, your app will be put into the background and will effectively be “paused”.
+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 Social Async Event.
+Syntax:
++++AdMob_RewardedInterstitial_Show()
Returns:
++ ++
Triggers:
++ ++
This event is triggered when the ad view is closed by the user.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedInterstitial_OnDismissed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This event is triggered is the awaited task fails.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedInterstitial_OnShowFailed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
This event is triggered is the awaited task succeeds.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedInterstitial_OnFullyShown" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This event is triggered if the user should be rewarded.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedInterstitial_OnReward" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This function will return whether the rewarded interstitial ad has been loaded or not.
+Syntax:
++++AdMob_RewardedInterstitial_IsLoaded()
Returns:
++ ++
Return the number of Rewarded Interstitial load instances are ready.
+Syntax:
++++AdMob_RewardedInterstitial_Instances_Count()
Returns:
++ ++
Versioning:
+1.3.0
- This function was introduced.This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.
+++This function was deprecated with version 1.3.0.
+
Initializes the target identifier for rewarded video ad functions.
+Note
+Please refer to AdMob_RewardedVideo_Set_AdUnit for more information.
+Syntax:
++++AdMob_RewardedVideo_Init(adUnitId)
Argument | +Type | +Description | +
---|---|---|
adUnitId | +String | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was deprecated.Set the target identifier for rewarded video functions, Rewarded video funcitons allow multiple identifiers
+Syntax:
++++AdMob_RewardedVideo_Set_AdUnit(adUnitId)
Argument | +Type | +Description | +
---|---|---|
adUnitId | +String | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.Release Rewarded Video load instances (passing -1 will free all the loaded instances).
+Syntax:
++++AdMob_RewardedVideo_Free_Load_Instances(count)
Argument | +Type | +Description | +
---|---|---|
count | +Real | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.Set the max number of Rewarded Video load instances, this allow present consecutiva ads. Default value is 1.
+Syntax:
++++AdMob_RewardedVideo_Max_Instances(count)
Argument | +Type | +Description | +
---|---|---|
count | +Real | ++ |
Returns:
+++N/A
+
Versioning:
+1.3.0
- This function was introduced.This function should be called when you want to load a rewarded video ad. Calling it will send a request to the ad server to provide a rewarded ad, which will then be loaded into the app for display. This function does not show the ad, just stores it in memory ready for showing. If you do not call this function before trying to show an ad, nothing will be shown. Note that you can check whether a rewarded video is loaded or not using the function AdMob_RewardedVideo_IsLoaded.
+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 Social Async Event.
+Syntax:
++++AdMob_RewardedVideo_Load()
Returns:
++ ++
Triggers:
++ ++
This event is triggered is the awaited task fails.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedVideo_OnLoadFailed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
This event is triggered is the awaited task succeeds.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedVideo_OnLoaded" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This function will show the rewarded video ad, if one is available and loaded. You can check whether an ad has previously been loaded using the function AdMob_RewardedVideo_IsLoaded. Note that while a rewarded video ad is being shown, your app will be put into the background and will effectively be “paused”.
+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 Social Async Event.
+Syntax:
++++AdMob_RewardedVideo_Show()
Returns:
++ ++
Triggers:
++ ++
This event is triggered when the ad view is closed by the user.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedVideo_OnDismissed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This event is triggered is the awaited task fails.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedVideo_OnShowFailed" |
+
unit_id | +String | +Unit identifier of the advertisment | +
errorMessage | +String | +the error code responsible for the failure | +
errorCode | +Real | +the error message of the error code | +
This event is triggered is the awaited task succeeds.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedVideo_OnFullyShown" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This event is triggered if the user should be rewarded.
+Key | +Type | +Description | +
---|---|---|
type | +String | +"AdMob_RewardedVideo_OnReward" |
+
unit_id | +String | +Unit identifier of the advertisment | +
This function will return whether the rewarded video ad has been loaded or not.
+Syntax:
++++AdMob_RewardedVideo_IsLoaded()
Returns:
++ ++
Return the number of Rewarded video load instances are ready.
+Syntax:
++++AdMob_RewardedVideo_Instances_Count()
Returns:
++ ++
Versioning:
+1.3.0
- This function was introduced.This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.
+ +This method provides control over the sound’s loudness when playing rewarded video ads. This method will trigger a reload of the current Interstitial and RewardedVideo ads.
+Syntax:
++++AdMob_Settings_SetVolume(value)
Argument | +Type | +Description | +
---|---|---|
value | +Real | +The amount to set the volume to. | +
Returns:
+++N/A
+
This method provides control over muting the sound when playing rewarded video ads. This method will trigger a reload of the current Interstitial and RewardedVideo ads.
+Syntax:
++++AdMob_Settings_SetMuted(value)
Argument | +Type | +Description | +
---|---|---|
value | +Real | ++ |
Returns:
+++N/A
+
The AdMob extension is to be used alongside your Google AdMob account (web page). All the required personal ad ids and consent messages should be handled through there.
+Warning
+To build and deploy to iOS it’s required for the developer to install CocoaPods. (installation guide)
+AdMob Console
→ Privacy and Messaging
→ Go to funding choices
→ (select your project)
→ Create (new message)
→ EU Consent
→ fill all the necessary details.This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.
+ +Toggles on/off ads for children. This function should be called BEFORE calling AdMob_Initialize.
+Warning
+Should be called before AdMob_Initialize.
+Syntax:
++++AdMob_Targeting_COPPA(COPPA)
Argument | +Type | +Description | +
---|---|---|
COPPA | +Boolean | ++ |
Returns:
+++N/A
+
Toggles on/off ads for under aged users. This function should be called BEFORE calling AdMob_Initialize.
+Warning
+Should be called before AdMob_Initialize.
+Syntax:
++++AdMob_Targeting_UnderAge(underAge)
Argument | +Type | +Description | +
---|---|---|
underAge | +Boolean | ++ |
Returns:
+++N/A
+
Allows for setting the maximum content rating of the ads to be displayed. This function should be called BEFORE calling AdMob_Initialize.
+Warning
+Should be called before AdMob_Initialize.
+Syntax:
++++AdMob_Targeting_MaxAdContentRating(contentRating)
Argument | +Type | +Description | +
---|---|---|
contentRating | +AdMobContentRating | ++ |
Returns:
+++N/A
+
This is the recommended workflow for using AdMob extension functions calls both on Android and iOS.
+Page not found
+ + +GameMaker 2024
+ +Achievements can be a great way to increase your users' engagement within your game. You can implement achievements in your game to encourage players to experiment with features they might not normally use, or to approach your game with entirely different play styles. Achievements can also be a fun way for players to compare their progress with each other and engage in light-hearted competition.
+The following functions are provided for working with achievements:
+The following constants are provided to be used as input arguments or output values:
+ +The following structurs are used as output values from the function calls to the GooglePlayServices API:
+ +This function requests the Google Play Services API to query the status of the achievements for the current player.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_Achievements_GetStatus(forceReload)
Argument | +Type | +Description | +
---|---|---|
forceReload | +Boolean | +Should we force reload the achievements status. | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_Achievements_GetStatus" |
+
ind | +Real | +The id of the request this callback refers to. | +
data | +String | +A json formatted string of an array of AchievementStatusJSON. This string can be parsed into a struct with the function json_parse. | +
Example:
+GooglePlayServices_Achievements_GetStatus(achievementId);
+The code sample above will initialize the status querie for all the available achievements. The result can then be caught inside an Social Async Event.
+if(async_load[?"type"] == "GooglePlayServices_Achievements_GetStatus")
+{
+ var array = json_parse(async_load[?"data"])
+
+ array_sort(array, function(_ach1, _ach2) { return _ach1.name < _ach2.name ? -1 : 1 });
+ for(var a = 0 ; a < array_length(array) ; a++)
+ {
+ var struct = array[a];
+
+ show_debug_message(struct);
+
+ var ins = instance_create_depth(150+a*300,room_height/2-50,0,Obj_GooglePlayServices_Achievement_Entry)
+ ins.ID = struct.id
+ ins.description = struct.description
+ ins.lastUpdatedTimestamp = struct.lastUpdatedTimestamp
+ ins.name = struct.name
+ ins.revealedImage = struct.revealedImage
+ ins.state = struct.state
+ ins.typeAchievement = struct.typeAchievement
+ ins.unlockedImage = struct.unlockedImage
+ ins.xpValue = struct.xpValue
+
+ if(ins.typeAchievement == Achievement_TYPE_INCREMENTAL)
+ {
+ ins.currentSteps = struct.currentSteps
+ ins.formattedCurrentSteps = struct.formattedCurrentSteps
+ ins.formattedTotalSteps = struct.formattedTotalSteps
+ ins.totalSteps = struct.totalSteps
+ }
+ }
+}
+The code above shows a way of reading the returned data using the function json_parse. This sample is taken from the demo project check the project for more context.
+This function requests the Google Play Services API to increment the achievement progress by a given amount of steps. Incremental achievements require a specific amount of steps before they are set as complete. You can also set the steps to a specific value using GooglePlayServices_Achievements_SetSteps.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_Achievements_Increment(achievementId, steps)
Argument | +Type | +Description | +
---|---|---|
achievementId | +String | +The unique identifier of the achievement | +
steps | +Real | +The amount of steps to increment by | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_Achievements_Increment" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
achievement_id | +String | +The unique name of the achievement | +
Example:
+GooglePlayServices_Achievements_Increment(achievementId, 1);
+The code sample above will increment the number of steps for the specified acheivement by 1. The result can be caught inside an Social Async Event as follows:
+if(async_load[?"type"] == "GooglePlayServices_Achievements_Increment")
+if(async_load[?"success"])
+{
+ //Done, let's continue
+}
+The code above checks if the task was successful. This sample is taken from the demo project check the project for more context.
+This function requests the Google Play Services API to change the state of a given achievement to revealed (AchievementState) for the currently signed in player.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_Achievements_Reveal(achievementId)
Argument | +Type | +Description | +
---|---|---|
achievementId | +String | +The unique identifier of the achievement | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_Achievements_Reveal" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
achievement_id | +String | +The unique name of the achievement | +
Example:
+GooglePlayServices_Achievements_Reveal(achievementId);
+The code sample above will set the state of the specified acheivement to revealed. The result can be caught inside an Social Async Event as follows:
+if(async_load[?"type"] == "GooglePlayServices_Achievements_Reveal")
+if(async_load[?"success"])
+{
+ //Done, let's continue
+}
+The code above checks if the task was successful. This sample is taken from the demo project check the project for more context.
+This function requests the Google Play Services API to set the achievement progress to a given amount of steps. Incremental achievements require a specific amount of steps before they are set as complete. You can also increment the steps by a given amount using GooglePlayServices_Achievements_Increment.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_Achievements_SetSteps()
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_Achievements_SetSteps" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
achievement_id | +String | +The unique name of the achievement | +
Example:
+GooglePlayServices_Achievements_SetSteps(achievementId,1);
+The code sample above will set the number of steps for the specified acheivement to 1. The result can be caught inside an Social Async Event as follows:
+if(async_load[?"type"] == "GooglePlayServices_Achievements_SetSteps")
+if(async_load[?"success"])
+{
+ //Done, let's continue
+}
+The code above checks if the task was successful. This sample is taken from the demo project check the project for more context.
+This function will call the Google Play Services achievement overlay with all your achievement information.
+Syntax:
++++GooglePlayServices_Achievements_Show()
Returns:
+++N/A
+
Example:
+GooglePlayServices_Achievements_Show()
+The code above will trigger the achievement overlay.
+This function requests the Google Play Services API to unlock (AchievementState) the given achievement for the currently signed in player.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_Achievements_Unlock(achievementId)
Argument | +Type | +Description | +
---|---|---|
achievementId | +String | +The unique identifier of the achievement | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_Achievements_Unlock" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
achievement_id | +String | +The unique name of the achievement | +
Example:
+GooglePlayServices_Achievements_Unlock(achievementId);
+The code sample above will set the state of the specified acheivement to unlocked. The result can be caught inside an Social Async Event as follows:
+if(async_load[?"type"] == "GooglePlayServices_Achievements_Unlock")
+if(async_load[?"success"])
+{
+ //Done, let's continue
+}
+The code above checks if the task was successful. This sample is taken from the demo project check the project for more context.
+These constants specify the achievement state.
+These constants are referenced by the following structs:
+ +Member | +Description | +
---|---|
Achievement_STATE_HIDDEN |
+Indicates a hidden achievement. | +
Achievement_STATE_REVEALED |
+Indicates a revealed achievement. | +
Achievement_STATE_UNLOCKED |
+Indicates an unlocked achievement. | +
These constants specify the type on an achievement.
+These constants are referenced by the following structs:
+ +Member | +Description | +
---|---|
Achievement_TYPE_INCREMENTAL |
+Indicates an incremental achievement. | +
Achievement_TYPE_STANDARD |
+Indicates a standard achievement. | +
Represents an achievement and its associated metadata.
+Member | +Type | +Description | +
---|---|---|
id | +String | +The ID of this achievement. | +
name | +String | +The name of this achievement. | +
description | +String | +The description for this achievement. | +
state | +AchievementState | +The AchievementState of the achievement. | +
typeAchievement | +AchievementType | +The AchievementType of the achievement. | +
xpValue | +Real | +The XP value of this achievement. | +
lastUpdatedTimestamp | +Real | +The timestamp (in millseconds since epoch) at which this achievement was last updated. | +
revealedImage | +String | +A URI string that can be used to load the achievement's revealed image icon (see GooglePlayServices_UriToPath). Not present if the achievement has no revealed image. | +
unlockedImage | +String | +A URI string that can be used to load the achievement's unlocked image icon (see GooglePlayServices_UriToPath). Not present if the achievement has no revealed image. | +
currentSteps | +Real | +The number of steps this user has gone toward unlocking this achievement. Only available for incremental achievement types (AchievementType). | +
formattedCurrentSteps | +String | +The number of steps this user has gone toward unlocking this achievement (formatted for the user's locale). Only available for incremental achievement types (AchievementType). | +
totalSteps | +Real | +The total number of steps necessary to unlock this achievement. Only available for incremental achievement types (AchievementType). | +
formattedTotalSteps | +String | +The total number of steps necessary to unlock this achievement, formatted for the user's locale. Only available for incremental achievement types (AchievementType). | +
The Google Play Services extension is to be used alongside your Google Developer account (web page). All the required personal leaderboard ids and achievement ids should be managed from there.
+++IMPORTANT
+Before using this extension make sure to correctly set up your Android application following the steps on this article. It's also important to note that the demo provided with extension is a reference demo meaning it cannot be played as is, as it would need our
+.keystore
and our Google Services ID which cannot be included with the package. +
As the Google Developer Console layout might change in the future you can check their official guide on setting up leaderboards: Adding Leaderboards.
+As the Google Developer Console layout might change in the future you can check their official guide on setting up achievements: Adding Achievements.
+Play Games Services sign-in provides you with a player's gaming identity, which is a platform-level, gaming-specific identity for Android players. This identity helps build a relationship between your game and the player. Players are more willing to use this identity to sign in than with alternate centralized systems.
+The following functions are provided for general tasks:
+The following structures are provided as response for some GooglePlayServices API calls:
+Queries the servers for the current 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 Social Async Event.
+Syntax:
++++GooglePlayServices_IsAuthenticated()
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_IsAuthenticated" |
+
success | +Boolean | +Whether or not the function request succeeded | +
isAuthenticated | +Boolean | +Whether or not player is authenticated | +
Example:
+GooglePlayServices_IsAuthenticated()
+The code sample above save the identifier that can be used inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_IsAuthenticated")
+{
+ if(!async_load[?"success"])
+ exit
+
+ if(async_load[?"isAuthenticated"]);
+ {
+ show_debug_message("GoolePlayServices Player Authenticated")
+ }
+ else
+ {
+ GooglePlayServices_SignIn()
+ }
+}
+The code above matches the response against the correct event type and, if the player is not authenticated yet, it calls GooglePlayServices_SignIn to initiate the sign in process.
+This function returns whether or not the user has GooglePlayServices installed into their devices. This is required for using any of the extension functions.
+Syntax:
++++GooglePlayServices_IsAvailable()
Returns:
++ ++
Example:
+if(GooglePlayServices_IsAvailable())
+{
+ show_debug_message("GooglePlayServices Available")
+ //Do something
+}
+The code sample above will check if the GooglePlayServices are installed into the device after a positive result from this call you can call any of the function from the extension.
+Requests server-side access to Play Games Services for the currently signed-in player, this is necessary for 3rd party apps that need GooglePlayServices authentication.
+When requested, an authorization code is returned that can be used by your server to exchange for an access token (and conditionally a refresh token when forceRefreshToken
is true
). The access token may then be used by your server to access the Play Games Services web APIs. This is commonly used to complete a sign-in flow by verifying the Play Games Services player ID.
If forceRefreshToken
is true
, when exchanging the authorization code, a refresh token will be returned in addition to the access token. The refresh token allows your server to request additional access tokens, allowing your server to continue accesses Play Games Services while the user is not actively playing your game. Refresh tokens are only generated for players that have auto sign-in setting 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 Social Async Event.
+Syntax:
++++GooglePlayServices_RequestServerSideAccess(serverClientId, forceRefreshToken)
Argument | +Type | +Description | +
---|---|---|
serverClientId | +String | +The client ID of the server that will perform the authorization code flow exchange. | +
forceRefreshToken | +Boolean | +If true , when the returned authorization code is exchanged, a refresh token will be included in addition to an access token. |
+
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_RequestServerSideAccess" |
+
success | +Boolean | +Whether or not the function request succeeded. | +
authCode | +String | +The authorization code | +
Example:
+GooglePlayServices_RequestServerSideAccess()
+The code sample above requests for an authorization code that will allow server side access, the code can be caught inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_RequestServerSideAccess")
+{
+ if(!async_load[?"success"])
+ exit
+
+ var authorizationCode = async_load[?"authCode"];
+ // Use the code to request a accessToken (with optional refreshToken)
+
+}
+The code above matches the response against the correct event type and in case of success caches the authorization code that can be later used on 3rd party libraries.
+Manually requests that your game sign in with Play Games Services.
+Note
+A sign-in attempt will be made automatically when your game starts. Games will only need to manually request to sign in if the automatic sign-in attempt failed.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_SignIn()
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_SignIn" |
+
success | +Boolean | +Whether or not the function request succeeded | +
isAuthenticated | +Boolean | +Whether or not player is authenticated | +
Example:
+GooglePlayServices_SignIn()
+The code sample above save the identifier that can be used inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_SignIn")
+{
+ if(!async_load[?"success"])
+ exit
+
+ if(async_load[?"isAuthenticated"]);
+ {
+ show_debug_message("GoolePlayServices Player Authenticated")
+ }
+ else
+ {
+ show_debug_message("Lets continue without GooglePlayGameServices")
+ }
+}
+The code above matches the response against the correct event type and logs the success of the task.
+This is the GameJSON is a json formatted string representing a game and its associated metadata.
+This struct is referenced by the following structs:
+ +Member | +Type | +Description | +
---|---|---|
areSnapshotsEnabled | +Boolean | +Whether or not this game supports snapshots. | +
achievementTotalCount | +Real | +The number of achievements registered for this game. | +
applicationId | +String | +The application ID for this game. | +
description | +String | +The description of this game. | +
developerName | +String | +The name of the developer of this game. | +
displayName | +String | +The display name for this game. | +
featuredImageUri | +String | +An image URI that can be used to load the game's featured (banner) image from Google Play (see GooglePlayServices_UriToPath). Not present if the game has no featured image. | +
hiResImageUri | +String | +An image URI that can be used to load the game's hi-res image (see GooglePlayServices_UriToPath). Not present if the game has no high-res image. | +
iconImageUri | +String | +An image URI that can be used to load the game's icon (see GooglePlayServices_UriToPath). Not present if the game has no icon image. | +
leaderboardCount | +Real | +The number of leaderboards registered for this game. | +
primaryCategory | +String | +The primary category of the game. | +
secondaryCategory | +String | +The secondary category of the game. | +
themeColor | +String | +The theme color for this game. | +
gamepadSupport | +Boolean | +Whether or not this game is marked as supporting gamepads. | +
Before you can add any cloud sync code and test it, you first have to set up an app listing on your Google Play Developer Console for the game and you will also have had to upload an APK to one of the available channels for testing - either Internal Test (recommended), Alpha or Beta is fine. Once that has been done, you will also need to set up the Game Services for the app.
+From the Developer dashboard, click the Game Services button on the left, then click the Add New Game button:
+ +This will then show you a screen where you have to give some details about the game, including a name and a category:
+ +After filling in the information and pressing Continue, you will now need to go to the Linked Apps section and get the App ID and set the app as being for Android:
+ +The App ID is shown at the top and you will need to take a note of it as we'll be using it in GameMaker later. When you click the Android button, you will then be prompted to give some information about the app you want to link the services too, and you should link it to an app that you have previously uploaded to the store.
+Once that's done, we have one final task and that is to enable Cloud Saving for the game services. This is done from the Game Details page:
+ +Before publishing the game publicly, you will need to complete the rest of the game details on this page, but for now, you can simply enable saving and then continue on to add the code into your project in GameMaker.
+This is the GooglePlayServices extension and it provides the developers with a set of tools for creating engaging and appealing games. Here you can find the full available API documentation and guides necessary to get you started with creating your games.
+This section hosts the guides to get you up and running.
+ +The following are the available modules from the GooglePlayServices API:
+ +For full documentation visit mkdocs.org.
+mkdocs new [dir-name]
- Create a new project.mkdocs serve
- Start the live-reloading docs server.mkdocs build
- Build the documentation site.mkdocs -h
- Print help message and exit.mkdocs.yml # The configuration file.
+docs/
+ index.md # The documentation homepage.
+ ... # Other markdown pages, images and other files.
+
+
+ Leaderboards can be a fun way to drive competition among your players, both for your most hardcore fans (who will be fighting for the top spot in a public leaderboard) and for your more casual players (who will be interested in comparing their progress to their friends').
+The following functions are provided for working with leaderboards:
+The following constants are provided to be used as input arguments or output values:
+ +The following structures are used as output values from the function calls to the GooglePlayServices API:
+ +Asynchronously load the player-centered page of scores for a given leaderboard. If the player does not have a score on this leaderboard, this call will return the first page instead.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_Leaderboard_LoadPlayerCenteredScores(leaderboardId, span, collection, maxResults, forceReload)
Argument | +Type | +Description | +
---|---|---|
leaderboardId | +String | +The unique identifier of the leaderboard. | +
span | +LeaderboardTimeSpan | +The time span to retrieve data for. | +
collection | +LeaderboardCollection | +he collection to retrieve scores for | +
maxResults | +Real | +The maximum number of scores to fetch per page. Must be between 1 and 25. | +
forceReload | +Boolean | +If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching. | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_Leaderboard_LoadPlayerCenteredScores" |
+
ind | +Real | +The id of the request this callback refers to. | +
data | +String | +A json formatted string of an array of LeaderboardEntryJSON. This string can be parsed into an array with the function json_parse. | +
Example:
+GooglePlayServices_Leaderboard_LoadPlayerCenteredScores(Leaderboard1, Leaderboard_TIME_SPAN_ALL_TIME, Leaderboard_COLLECTION_PUBLIC, 5, true)
+The code sample above will start a query for player centered leaderboard entries. The results can be caught inside an Social Async Event.
+if(async_load[?"type"] == "GooglePlayServices_Leaderboard_LoadPlayerCenteredScores")
+{
+ var array = json_parse(async_load[?"data"])
+ for(var a = 0 ; a < array_length(array) ; a ++)
+ {
+ var struct = array[a]
+ var ins = instance_create_depth(800,200+a*75,00,Obj_GooglePlayServices_Leaderboard_Entry)
+ ins.displayRank = struct.displayRank;
+ ins.displayScore = struct.displayScore;
+ ins.rank = struct.rank;
+ ins.rawScore = struct.rawScore;
+ ins.scoreHolder = struct.scoreHolder;
+ ins.scoreHolderDisplayName = struct.scoreHolderDisplayName;
+ ins.scoreHolderHiResImageUri = struct.scoreHolderHiResImageUri;
+ ins.scoreHolderIconImageUri = struct.scoreHolderIconImageUri;
+
+ // This is an options parameter and is only present if a scoreTag was provided.
+ ins.scoreTag = struct[$ "scoreTag"];
+
+ ins.timestampMillis = struct.timestampMillis;
+ }
+}
+The code above shows a way of reading the returned data using the function json_parse. This sample is taken from the demo project check the project for more context.
+Asynchronously load the top page of scores for a given leaderboard.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_Leaderboard_LoadTopScores(leaderboardId, span, collection, maxResults, forceReload)
Argument | +Type | +Description | +
---|---|---|
leaderboardId | +String | +The unique identifier of the leaderboard. | +
span | +LeaderboardTimeSpan | +The time span to retrieve data for. | +
collection | +LeaderboardCollection | +he collection to retrieve scores for | +
maxResults | +Real | +The maximum number of scores to fetch per page. Must be between 1 and 25. | +
forceReload | +Boolean | +If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching. | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_Leaderboard_LoadTopScores" |
+
ind | +Real | +The id of the request this callback refers to. | +
data | +String | +A json formatted string of an array of LeaderboardEntryJSON. This string can be parsed into an array with the function json_parse. | +
Example:
+GooglePlayServices_Leaderboard_LoadTopScores(Leaderboard1, Leaderboard_TIME_SPAN_ALL_TIME, Leaderboard_COLLECTION_PUBLIC, 5, true)
+The code sample above will start a query for top scores leaderboard entries. The results can be caught inside a Social Async Event.
+if(async_load[?"type"] == "GooglePlayServices_Leaderboard_LoadTopScores")
+{
+ var array = json_parse(async_load[?"data"])
+ for(var a = 0 ; a < array_length(array) ; a ++)
+ {
+ var struct = array[a]
+ var ins = instance_create_depth(800,200+a*75,00,Obj_GooglePlayServices_Leaderboard_Entry)
+ ins.displayRank = struct.displayRank;
+ ins.displayScore = struct.displayScore;
+ ins.rank = struct.rank;
+ ins.rawScore = struct.rawScore;
+ ins.scoreHolder = struct.scoreHolder;
+ ins.scoreHolderDisplayName = struct.scoreHolderDisplayName;
+ ins.scoreHolderHiResImageUri = struct.scoreHolderHiResImageUri;
+ ins.scoreHolderIconImageUri = struct.scoreHolderIconImageUri;
+
+ // This is an options parameter and is only present if a scoreTag was provided.
+ ins.scoreTag = struct[$ "scoreTag"];
+
+ ins.timestampMillis = struct.timestampMillis;
+ }
+}
+The code above shows a way of reading the returned data using the function json_parse. This sample is taken from the demo project check the project for more context.
+This function will call the Google Play Services overlay for a specific leaderboard.
+Syntax:
++++GooglePlayServices_Leaderboard_Show(leaderboardId)
Argument | +Type | +Description | +
---|---|---|
leaderboardId | +String | +The unique identifier of the leaderboard. | +
Returns:
+++N/A
+
Example:
+GooglePlayServices_Leaderboard_Show(leaderboardId);
+The code above will trigger the leaderboard overlay of the given leaderboard.
+This function will call the general Google Play Services leaderboards overlay. Here the user will have access to all the existing leaderboards of the current application.
+Syntax:
++++GooglePlayServices_Leaderboard_ShowAll()
Returns:
+++N/A
+
Example:
+GooglePlayServices_Leaderboard_ShowAll()
+The code above will trigger the leaderboard overlay of all the available leaderboards for this game.
+This function requests the Google Play Services API to submit a score to the given leaderboard.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_Leaderboard_SubmitScore(leaderboardId, score, scoreTag)
Argument | +Type | +Description | +
---|---|---|
leaderboardId | +String | +The unique identifier of the leaderboard. | +
score | +Real | +The value to be submitted to the leaderboard (remember that only the highest score value is displayed in the leaderboard). | +
scoreTag | +String | +A tag that will be added to the value being submitted to the leaderboard (note that this value is required, if you don't want to set a tag use an empty string). | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_Leaderboard_SubmitScore" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
leaderboardId | +String | +The unique name of the leaderboard. | +
score | +Real | +The submitted score. | +
scoreTag | +String | +The tag for the current submission. | +
report | +String | +A json formatted string of LeaderboardReportJSON. This string can be parsed into a struct with the function json_parse. Only available if the task succeeds. | +
Example:
+GooglePlayServices_Leaderboard_SubmitScore(leaderId, 100, "archer");
+The code sample above will submit a new score to the leaderboard with a specific tag ("archer"). The result can be caught inside a Social Async Event as follows:
+if(async_load[?"type"] == "GooglePlayServices_Leaderboard_SubmitScore")
+if(async_load[?"success")
+{
+ //Done, let's continue
+}
+The code above checks if the task was successful. This sample is taken from the demo project check the project for more context.
+These constants represent kinds of leaderboard collections.
+These constants are referenced by the following functions:
+Member | +Description | +
---|---|
Leaderboard_COLLECTION_SOCIAL |
+These leaderboards contain the scores of players in the viewing player's friends list. | +
Leaderboard_COLLECTION_PUBLIC |
+Public leaderboards contain the scores of players who are sharing their gameplay activity publicly. | +
These constants represent the various types of time span that can be used.
+These constants are referenced by the following functions:
+Member | +Description | +
---|---|
Leaderboard_TIME_SPAN_DAILY |
+Refers to the scores of the day. Scores are reset every day. The reset occurs at 11:59PM PST. | +
Leaderboard_TIME_SPAN_WEEKLY |
+Refers to the scores of the week. Scores are reset once per week. The reset occurs at 11:59PM PST on Sunday. | +
Leaderboard_TIME_SPAN_ALL_TIME |
+Refers to all the scores. Scores are never reset. | +
Represents a score and its associated metadata.
+Member | +Type | +Description | +
---|---|---|
displayRank | +String | +A formatted string to display for this rank. This handles appropriate localization and formatting. | +
displayScore | +String | +A formatted string to display for this score. The details of the formatting are specified by the developer in their dev console. | +
rank | +Real | +The rank returned from the server for this score. Note that this may not be exact and that multiple scores can have identical ranks. Lower ranks indicate a better score, with rank 1 being the best score on the board. | +
rawScore | +Real | +The raw score value. | +
scoreHolder | +PlayerJSON | +A struct of PlayerJSON. | +
scoreHolderDisplayName | +String | +The display name of the player that scored this particular score. | +
scoreHolderHiResImageUri | +String | +The URI of the hi-res image to display for the player who scored this score (you can later convert the uri to a local path using the GooglePlayServices_UriToPath). | +
scoreHolderIconImageUri | +String | +The URI of the icon image to display for the player who scored this score (you can later convert the uri to a local path using the GooglePlayServices_UriToPath). | +
Represents a leaderboard report and its associated metadata.
+Member | +Type | +Description | +
---|---|---|
allTime | +LeaderboardReportEntryJSON | +The all time result report. | +
weekly | +LeaderboardReportEntryJSON | +The weekly result report. | +
daily | +LeaderboardReportEntryJSON | +The daily result report | +
Represents a leaderboard report entry.
+This struct is referenced by the following structs:
+ +Member | +Type | +Description | +
---|---|---|
isNewBest | +Boolean | +Whether or not this score is a new best. | +
score | +Real | +The score submitted to the server. | +
scoreTag | +String | +The tag used the submittion of the achievement. | +
Being able to access player information allows for a much better gaming experience. The game can be tailored to the gamer in new and creative ways. This functions will allow you to gain that kind of costumization.
+The following functions are provided for working with player data:
+The following structures are used by the API to expose data to the developer:
+This function queries the Google Play server for information on the current signed-in player.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_Player_Current()
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_Player_Current" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded | +
player | +String | +The information of the player as a json formatted string of PlayerJSON. This string can be parsed into a struct with the function json_parse. | +
Example:
+GooglePlayServices_Player_Current()
+The code sample above will trigger a player data fetch and the callback can be caught inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_Player_Current")
+{
+ if(!async_load[?"success"])
+ exit
+
+ var playerInfo = json_parse(async_load[? "player"]);
+
+ // ### Available members #### (some are optional, check documentation)
+ // bannerImageLandscapeUri
+ // bannerImagePortraitUri
+ // displayName
+ // hiResImageUri
+ // iconImageUri
+ // currentXpTotal
+ // lastLevelUpTimestamp
+ // currentLevelNumber
+ // currentMaxXp
+ // currentMinXp
+ // nextLevelNumber
+ // nextMaxXp
+ // nextMinXp
+ // playerId
+ // retrievedTimestamp
+ // title
+
+}
+The code above matches the response against the correct event type and parses the player data string into a struct (PlayerJSON) using the function json_parse. This sample is taken from the demo project check the project for more context.
+This function queries the Google Play server for information on the current player's unique id.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_Player_CurrentID()
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_Player_CurrentID" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
playerID | +String | +The unique identifier of the current player. | +
Example:
+GooglePlayServices_Player_CurrentID()
+The code sample above save the identifier that can be used inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_Player_CurrentID")
+{
+ if(!async_load[?"success"])
+ exit
+
+ var playerId = async_load[? "playerID"];
+}
+The code above matches the response against the correct event type and cache the playerID into a variable.
+This function queries the Google Play server for a lot of statistical values regarding the logged in player.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_PlayerStats_LoadPlayerStats()
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_PlayerStats_LoadPlayerStats" . |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
AverageSessionLength | +Real | +The average session length of the player in minutes. | +
DaysSinceLastPlayed | +Real | +The approximate number of days since the player last played. | +
NumberOfPurchases | +Real | +The approximate number of in-app purchases for the player. | +
NumberOfSessions | +Real | +The approximate number of sessions of the player. | +
SessionPercentile | +Real | +The approximation of sessions percentile for the player. | +
SpendPercentile | +Real | +The approximate spend percentile of the player. | +
Example:
+GooglePlayServices_PlayerStats_LoadPlayerStats()
+The code sample above save the identifier that can be used inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_PlayerStats_LoadPlayerStats")
+{
+ if(!async_load[?"success"])
+ exit
+
+ // Do something with the data
+}
+The code above matches the response against the correct event type and bails out if the task was not successful.
+Represents a player and its associated metadata.
+This struct is referenced by the following structs:
+ +Member | +Type | +Description | +
---|---|---|
bannerImageLandscapeUri | +String | +The URI for loading this player's landscape banner image (see GooglePlayServices_UriToPath). Not present if the player has no landscape banner image image. | +
bannerImagePortraitUri | +String | +The URI for loading this player's portrait banner image (see GooglePlayServices_UriToPath). Not present if the player has no portrait banner image. | +
displayName | +String | +The display name for this player. | +
hiResImageUri | +String | +The URI for loading this player's hi-res profile image (see GooglePlayServices_UriToPath). Not present if the player has no high-resolution image. | +
iconImageUri | +String | +The URI for loading this player's icon-size profile image (see GooglePlayServices_UriToPath). Not present if the player has no icon image. | +
currentXpTotal | +Real | +The player's current XP value. | +
lastLevelUpTimestamp | +Real | +The timestamp of the player's last level-up. | +
currentLevelNumber | +Real | +The number for the current level. | +
currentMaxXp | +Real | +The maximum XP value represented by the current level, exclusive. | +
currentMinXp | +Real | +The minimum XP value needed to attain the current level, inclusive. | +
nextLevelNumber | +Real | +The number for the next level. Not present if the player is already at the maximum level. | +
nextMaxXp | +Real | +The maximum XP value represented by the next level, exclusive. Not present if the player is already at the maximum level. | +
nextMinXp | +Real | +The minimum XP value needed to attain the next level, inclusive. Not present if the player is already at the maximum level. | +
playerId | +String | +The ID of this player. | +
retrievedTimestamp | +Real | +The timestamp at which this player record was last updated locally. | +
title | +String | +The title of the player. | +
hasHiResImage | +Boolean | +Indicates whether this player has a hi-res profile image to display. | +
hasIconImage | +Boolean | +Indicates whether this player has an icon-size profile image to display. | +
The Saved Games service gives you a convenient way to save your players' game progression to Google's servers. Your game can retrieve the saved game data to allow returning players to continue a game at their last save point from any device.
+The Saved Games service makes it possible to synchronize a player's game data across multiple devices. For example, if you have a game that runs on Android, you can use the Saved Games service to allow a player to start a game on their Android phone, and then continue playing on a tablet without losing any of their progress. This service can also be used to ensure that a player's game play continues from where it left off even if their device is lost, destroyed, or traded in for a newer model.
+The following functions are provided for working with saved games:
+The following structurs are used as output values from the function calls to the GooglePlayServices API:
+ +This function requests the Google Play Services API to commit data to a given save slot. The unique identifier of the slot needs to exist meaning that this function will only update already existing files (see GooglePlayServices_SavedGames_CommitNew for creating new ones) but the description
, data
and coverPath
can be changed if needed.
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 Social Async Event.
+Syntax:
++++GooglePlayServices_SavedGames_CommitAndClose(name, description, data, coverPath)
Argument | +Type | +Description | +
---|---|---|
name | +String | +The unique identifier of the save game slot. | +
description | +String | +The description of the current save slot. | +
data | +String | +A string containing the data you want to save (note you can use json formatted string to store data). | +
coverPath | +String | +The path to the image to be used as a save slot cover image. | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_SavedGames_CommitAndClose" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
Example:
+GooglePlayServices_SavedGames_CommitAndClose("slot_1", "Random Description....", json_stringify(struct), coverPath);
+The code sample above save the identifier that can be used inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_SavedGames_CommitAndClose")
+{
+ if(async_load[? "success"])
+ show_debug_message("Saved")
+ else
+ show_debug_message("Not saved :(")
+}
+The code above matches the response against the correct event type and logs the success of the task. For a full usage sample check the provided demo.
+This function requests the Google Play Services API to commit data to a given save slot. This function will create a new slot, if you want to update an already existing slot use the GooglePlayServices_SavedGames_CommitAndClose function.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_SavedGames_CommitNew(name, description, data, coverPath)
Argument | +Type | +Description | +
---|---|---|
name | +String | +The unique identifier of the save game slot. | +
description | +String | +The description of the current save slot. | +
data | +String | +A string containing the data you want to save (note you can use json formatted string to store data). | +
coverPath | +String | +The path to the image to be used as a save slot cover image. | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_SavedGames_CommitAndClose" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
snapshotMetadata | +String | +A json formatted string of SnapshotMetadataJSON. This string can be parsed into a struct with the function json_parse. Only available if the task succeeds. | +
Example:
+GooglePlayServices_SavedGames_CommitNew("slot_1", "Random Description....", json_stringify(struct), coverPath);
+The code sample above save the identifier that can be used inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_SavedGames_CommitNew")
+{
+ if(async_load[? "success"])
+ show_debug_message("Created");
+
+ var snapshots = json_parse(async_load[?"snapshotMetadata"]);
+ // Do something with the snapshots
+ else
+ show_debug_message("Not created :(")
+}
+The code above matches the response against the correct event type and logs the success of the task. For a full usage sample check the provided demo.
+This function requests the Google Play Services API to delete a given save slot given its unique identifier.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_SavedGames_Delete(name)
Argument | +Type | +Description | +
---|---|---|
name | +String | +The unique identifier of the save game slot. | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_SavedGames_Delete" | +
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
Example:
+GooglePlayServices_SavedGames_Delete("slot_1");
+The code sample above save the identifier that can be used inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_SavedGames_Delete")
+{
+ if(async_load[? "success"])
+ show_debug_message("Deleted")
+ else
+ show_debug_message("Not Deleted :(")
+}
+The code above matches the response against the correct event type and logs the success of the task. For a full usage sample check the provided demo.
+This function requests the Google Play Services API to discard changes and close the currently opened save slot.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_SavedGames_DiscardAndClose(name)
Argument | +Type | +Description | +
---|---|---|
name | +String | +The unique identifier of the save game slot. | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_SavedGames_DiscardAndClose" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
Example:
+GooglePlayServices_SavedGames_DiscardAndClose("slot_1")
+The code sample above save the identifier that can be used inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_SavedGames_DiscardAndClose")
+{
+ if(async_load[? "success"])
+ show_debug_message("Closed (discarding)")
+ else
+ show_debug_message("Not closed :(")
+}
+The code above matches the response against the correct event type and logs the success of the task. For a full usage sample check the provided demo.
+This function requests the Google Play Services API to query all the save slot metadata of the currently signed-in user.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_SavedGames_Load(forceReload)
Argument | +Type | +Description | +
---|---|---|
forceReload | +Boolean | +Whether or not the current local cache should be cleared and a new fetch should be performed from the server. | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_SavedGames_Load" |
+
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
snapshots | +String | +A json formatted string of an array of SnapshotMetadataJSON. This string can be parsed into a struct with the function json_parse. Only available if the task succeeds. | +
Example:
+GooglePlayServices_SavedGames_Load(true)
+The code sample above save the identifier that can be used inside an Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_SavedGames_Load")
+{
+ if(!async_load[?"success"])
+ exit
+
+ var snapshots = json_parse(async_load[?"snapshots"]);
+ //do something with snapshots
+}
+The code above matches the response against the correct event type and logs the success of the task. For a full usage sample check the provided demo.
+This function requests the Google Play Services API to open a given save slot given its unique name identifier.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_SavedGames_Open(name)
Argument | +Type | +Description | +
---|---|---|
name | +String | +The unique identifier of the save game slot. | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_SavedGames_Open" | +
ind | +Real | +The id of the request this callback refers to. | +
success | +Boolean | +Whether or not the function request succeeded. | +
data | +String | +The string previously saved to the Google Play Services. Only available if the task succeeds. | +
Example:
+GooglePlayServices_SavedGames_Open("slot_1")
+The code sample above save the identifier that can be used inside an Social Async Event
+if(async_load[? "type"] == "GooglePlayServices_SavedGames_Open")
+if (!async_load[? "success"])
+{
+ GooglePlayServices_SavedGames_Load(true);
+
+ var data = async_load[? "data"];
+ // do something with the data
+ return;
+}
+The code above matches the response against the correct event type and logs the success of the task. For a full usage sample check the provided demo.
+This function requests Google Play Services API to open the saved games UI overlay, giving you the ability to see, add (optional) and delete (optional) the save slots.
+Note
+This function will open an overlay the user can interact with, during this time there are some Async Social events that can be trigger depending on the actions performed by the user. Theses events are showed in the tables below.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_SavedGames_ShowSavedGamesUI(title, add, delete, max)
Argument | +Type | +Description | +
---|---|---|
title | +String | +The text to be used as the title of the overlay. | +
add | +Boolean | +Whether or not the Add slot button should be displayed. | +
delete | +Boolean | +Whether or not the Delete slot button should be displayed. | +
max | +Boolean | +Sets the maximum amount of slots allowed. This can be useful to limit the number of saves you want the player to be able to create. | +
Returns:
++ ++
Triggers:
++ ++
Triggered whenever an existing slot is selected
+Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_SavedGames_ShowSavedGamesUI_OnOpen" . |
+
ind | +Real | +The id of the request this callback refers to. | +
snapshotMetadata | +String | +A json formatted string of SnapshotMetadataJSON. This string can be parsed into a struct with the function json_parse. | +
Triggered whenever a new slot is created.
+Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_SavedGames_ShowSavedGamesUI_OnNew" . |
+
ind | +Real | +The id of the request this callback refers to. | +
Triggered when the dialog is closed.
+Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_SavedGames_ShowSavedGamesUI_OnExit" . |
+
ind | +Real | +The id of the request this callback refers to. | +
Example:
+GooglePlayServices_SavedGames_ShowSavedGamesUI("Save Point", true, true, 3)
+The code above will trigger the save games overlay with options to create/delete save slots and with a maximum number of 3 slots. From now on the triggered events can be caught inside an Social Async Event, as follows:
+switch(async_load[? "type"])
+{
+ case "GooglePlayServices_SavedGames_ShowSavedGamesUI_OnNew":
+ dialog_ind = get_string_async("Description: ","Slot #0");
+ break;
+
+ case "GooglePlayServices_SavedGames_ShowSavedGamesUI_OnOpen":
+ var snapshotMeta = json_parse(async_load[? "snapshotMetadata"]);
+ var uniqueName = snapshotMeta.uniqueName;
+ GooglePlayServices_SavedGames_Open(uniqueName);
+ break;
+
+ case "GooglePlayServices_SavedGames_ShowSavedGamesUI_OnExit":
+ GooglePlayServices_SavedGames_Load(true);
+ break;
+}
+The code above matches the response against the correct event type and acts accordingly by requesting the user a description for the new slot (if a new slot was created), opens a existinf slot (using GooglePlayServices_SavedGames_Open, if the user selects an existing one) or reloads the slot data (using GooglePlayServices_SavedGames_Load, if the user closes the overaly). For a full usage sample check the provided demo.
+Is a json formatted string that represents a snapshot and its associated metadata.
+Member | +Type | +Description | +
---|---|---|
coverImageAspectRatio | +Real | +The aspect ratio of the cover image for this snapshot, if any. | +
coverImageUri | +String | +An image URI that can be used to load the snapshot's cover image (see GooglePlayServices_UriToPath). Not present if the metadata has no cover image. | +
description | +String | +The description of this snapshot. | +
deviceName | +Real | +The name of the device that wrote this snapshot, if known. | +
game | +GameJSON | +A struct of GameJSON. | +
lastModifiedTimestamp | +Real | +The last time this snapshot was modified, in millis since epoch. | +
owner | +PlayerJSON | +A struct of PlayerJSON. | +
playedTime | +Real | +The played time of this snapshot in milliseconds. | +
progressValue | +Real | +The progress value for this snapshot. | +
uniqueName | +String | +The unique identifier of this snapshot. | +
hasChangePending | +Boolean | +Indicates whether or not this snapshot has any changes pending that have not been uploaded to the server. | +
This modules provides the user with some utility functions.
+The following functions are provided for helping with development:
+ +Some of the functions callbacks in this API return URIs (unique resource identifiers). However if you need to open these files or load them as images (using the sprite_add function) it is necessary to convert these URIs into paths. This function requests the Google Play Services API for the path to a given URI.
+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 Social Async Event.
+Syntax:
++++GooglePlayServices_UriToPath(uri)
Argument | +Type | +Description | +
---|---|---|
uri | +String | +The URI to get the path from. | +
Returns:
++ ++
Triggers:
++ ++
Key | +Type | +Description | +
---|---|---|
type | +String | +The string "GooglePlayServices_UriToPath" |
+
success | +Boolean | +Whether or not the function request succeeded. | +
ind | +Real | +The id of the request this callback refers to. | +
path | +String | +The path to the resource. | +
Example:
+var request = GooglePlayServices_UriToPath(uri)
+The code sample above save the identifier that can be used inside Social Async Event.
+if(async_load[? "type"] == "GooglePlayServices_UriToPath")
+if(async_load[?"ind"] == request)
+{
+ if(!async_load[?"success"])
+ exit
+
+ sprite = sprite_add(async_load[?"path"], 0, 0, 0, 0, 0);
+}
+The code above matches the response against the correct event type and request identifier (ind) . And loads the resolved path as a sprite using the sprite_add function.
+This function grants one item in exchange for a set of other items.
+The API currently takes an array of items to generate but at this time the size of that array must be 1 and the quantity of the new item must be 1.
+Note
+Any items that can be granted MUST have an exchange attribute in their itemdef.
+Warning
You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.
@@ -792,7 +797,7 @@This function transfers items between stacks within a user's inventory.
+Transfer items between stacks within a user's inventory.
+This can be used to stack, split, and moving items. The source and destination items must have the same itemdef id. To move items onto a destination stack specify the source, the quantity to move, and the destination item id. To split an existing stack, pass steam_item_instance_id_invalid
into dest_item_id
. A new item stack will be generated with the requested quantity.
Warning
You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.
@@ -1315,7 +1320,7 @@steam_item_instance_id_invalid
to create a new stackExample:
-handle = steam_inventory_transfer_item_quantity(global.apple, 2, global.oranges);
-The above code will trigger a transfer between two items owned by the user the amount to be transferred in the example, the user will lose 2 apples and receive 2 oranges. For an example on how to use the Steam Async Event to read the callback response, refer to the function steam_inventory_get_all_items.
+handle = steam_inventory_transfer_item_quantity(global.apples[0], 2, global.apples[1]);
+The above code will trigger a transfer between two item stacks owned by the user the amount to be transferred in the example, this will move 2 apples from stack 0 to stack 1. For an example on how to use the Steam Async Event to read the callback response, refer to the function steam_inventory_get_all_items.