Game Maker Firebase Dynamic Links

Welcome to the part three of my Firebase Tools series, Firebase Dynamic Links. Game Maker Firebase Dynamic Links extension. Firstly, I’ll detail you what this extension can do.

Setup Firebase Tools for Game Maker Studio

To be able to use the extension, you must prepare Game Maker Studio 2 to be able to compile for it. Click the link above to complete it.
For now, the extension only works at Android Exports.

What is a Dynamic Link


With Dynamic Links, your users get the best available experience for the platform they open your link on. If a user opens a Dynamic Link on iOS or Android, they can be taken directly to the linked content in your native app. If a user opens the same Dynamic Link in a desktop browser, they can be taken to the equivalent content on your website.

Retrieved from https://firebase.google.com/docs/dynamic-links/

Game Maker Dynamic Links extension allows you to share an entry point from your app to the internet. This is very much like going to a website, but in this case, you can go to a particular content within your app.

How Dynamic Links Work

Let’s say we created a shortlink like : game.page.link/playWithMarty

If the player has the game installed on their phone, and they opened the link above, they’d be directed to your game directly. You can then know that “your game is opened from this link” and take further actions(Like rewarding players etc.).

Also the links are super dynamic. This means that they work differently for different players. An example would be;

  • Opened from Android : Game is opened if installed, or directed to Google Play to be installed. After installation, you will still get the deep link.
  • Opened from iOS, same above with iTunes.
  • Opened from PC, you can direct them to your Html5 game page, or do whatever you want
In addition to the basic Firebase Setup, please change android:host within the Dynamic Links extension to your Firebase Dynamic Link Base URL

DOCUMENTATION

firebase_dynamic_links_debug_mode(True/False);
Description
: Enables or disables debug logging. You’ll see the debug output on Game Maker Studio IDE(Output).
Notice : You can use this function before/after firebase_dynamic_links_init function.

firebase_dynamic_links_init();
Description : Initializes Dynamic Links. After using the function, it will return a Social Async Event includes the deeplink, or N/A if the game is not started from a Deep Link.

Returns : An async ds_map in Social Async Event.
async_load[“category”] = “dynamic_links_deeplink” (String)
async_load[“status”] = 1, 0 or -1
0 : Game is not started with a Deep Link.
1 : The Game is started with a Deep Link.
-1 : Failed to read the Deep Link data.
async_load[“data”] = “FAILED”, “N/A” or a Deep Link (String)
“FAILED” : Is returned when failed.
“N/A” : Is returned when there’s no Deep Link.
Deep Link Data : Is returned when there is a Deep Link. This may be something like game.page.link/martysgame

//Social Async Event
var category = async_load[? "category"];

if (category == "dynamic_links_deeplink")
{
	var status = async_load[? "status"];
	var data = async_load[? "data"];
	if (status==1)  //Yes this app is opened from a deep link.
	{
		show_message_async("This game is opened from the URL : "+string(data));
	}
}

firebase_dynamic_links_generate_basic(String toLink, String fromLink, string androidPackageName, string iosPackageName);
Description : Fastest way to create a short link.

Parameters
@0 toLink : The URL that the player will be taken to. If the player does not have your game installed, you can set this link to your game’s Google Play page.

@1 fromLink : The domain you created on your Firebase Panel. Your link will be created with that domain and you can add your deep link at the end of the url. (Like your.domain.firebase.etc.com/myDeepLink)

@2 androidPackageName : The package identifier of your Android game. For example : “com.gmdevblog.gameexample”

@3 iosPackageName : The package identifier of your iOS game. For example : “com.gmdevblog.gameexample”

Returns : An async ds_map is Social Async Event.
async_load[“category”] = dynamic_link_basic(String)
async_load[“status”] = 0 or 1
0 : Failed to create a shortlink (Probably there’s no internet connection)
1 : Successfully created the shortlink.
async_load[“data”] = “N/A” or shortlink (String)
“N/A” : Failed!
shortlink : The URL of the shortlink.

firebase_dynamic_links_generate_basic("https://forums.yoyogames.com", "myDeepLink","com.gmdevblog.firebasetest", "com.gmdevblog.firebasetest");

And after creating the link, our link is created and returned in Social Async Event.

//Social Async Event
var category = async_load[? "category"];
if (category == "dynamic_link_basic")
{
	var status = async_load[? "status"];
	var data = async_load[? "data"];
	
	if (status==1)
	{
		show_message_async("Short link created as : "+string(data));
	}
}

Get it on Marketplace (FREE)

Share

Marty

Truely speaking, I don't know what am I doing most of the time.

6 Responses

  1. Charles says:

    Hi there,

    Trying to get this done with GMS2. I have succesfully created a manual link in the Firebase console and the app opens! I did this using your extension and explanation. However, I want to create manual links as well. I followed your tutorial, but it didn’t work and the debugger shows the following:

    09-12 17:09:57.187 9612 9612 D yoyo : doSetup called – /data/app/com.COMPANYNAME.testdeeplink-1/base.apk
    09-12 17:09:57.187 9612 9612 I yoyo : checking 1 extensions for ad interface
    09-12 17:09:57.187 9612 9612 I yoyo : BILLING: setupInAppBilling
    09-12 17:09:57.190 9612 9612 I yoyo : Extension Class not found: com.COMPANYNAME.testdeeplink.GooglePlayServicesExtension attempting to call InitRunnerBilling
    09-12 17:09:57.190 9612 9612 I yoyo : BILLING: Google Play permissions not available, selecting NULL billing solution

    This is merely a test project, so I have a completely empty file. Could you help me out please? Thanks!

    • gmdevblog says:

      Hello Charles. The error message does not belong to the Firebase Dynamic Links extension. I can create shortlinks within my app right now.

      Just a notice: I will update all my Firebase Extensions, including Dynamic Links. Thanks to Yoyogames, they updated Game Maker’s internal APIs to newer versions so that I can update my extensions too.

      I am waiting for the update to be public, then I will update all the extensions. I’ll investigate what we can do for now.

  2. SuproGames says:

    Is this for GMS1.4 as well? If not, what changes must be done before it can?

    • Marty McFly says:

      Hi. Although I have never tested it in there, the extension should be working. Follow the installation guide here

      One difference here is that your runner files are stored where you installed the game maker, which can be accessed by : Help > Open Gamemaker in Explorer in Game Maker Studio 1.4 IDE.

Leave a Reply