• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

GMS 2 Facebook dialogue open in app?

P

Plan-G

Guest
Hi all,

I've been programming my mobile game to make use of Facebook sharing. I'm using the Facebook dialogue function, and I've managed to get it working, but I have one major concern: the function opens the default browser on my mobile device. I would like it to open the Facebook mobile app (if installed on my users' devices, and if not, then default to the default browser).

The reality is that most users will have the Facebook app installed and be logged in. Popping up a share dialogue in their browser will almost certainly require them to log in again, especially if their default browser is say, Safari, and they use Chrome. That's going to kill the share rate.

Here's where I'm at:

- Followed GMS2 user manual to the letter on this.

- Created my Facebook app

- Enabled "Use Facebook" in GMS2 Options > iOS, and provided Facebook app ID + name.

- Installed the "Facebook" extension into GMS2 (free one from YYG https://marketplace.yoyogames.com/assets/2011/facebook)

- Called
Code:
facebook_init()
once at the start of the game

- Implemented
Code:
        var interactiveMap;
        interactiveMap = ds_map_create(); /
        ds_map_add(interactiveMap, "link", "mywebsite");
        ds_map_add(interactiveMap, "name", "Test");
        ds_map_add(interactiveMap, "caption", "Testinfo");
        facebook_dialog("share", interactiveMap, -1);
        ds_map_destroy(interactiveMap);
Tested on iOS and sharing does work, albeit via the browser.

So the question is: How can I get the facebook dialogue function to check for Facebook app installed on the user device and launch that, or if not, default to this standard behaviour? Any thoughts most welcome!

Thanks in advance.
 
Last edited by a moderator:

Nocturne

Friendly Tyrant
Forum Staff
Admin
Moderator
This is pretty much the default behaviour for the facebook API, and according to them opening Facebook in Safari is a better UI experience for users: https://developers.facebook.com/blog/post/2015/10/29/Facebook-Login-iOS9/

I think you CAN enable it though by switching on "Single Sign In" for the app in the Facebook pages, although you may also need to inject some extra code into the plist file (I have no idea about this though as I don't do iOS development currently).
 
P

Plan-G

Guest
Thanks for the reply ;)

You were right, I did have SSO enabled, but the FacebookAppID was not in the .plist file for some reason. I added that and it works perfectly now :) Nice that it gives the choice to open the dialogue in the FB app, or use the browser. I was signed into the app, selected that option and shared with no login required - sweet :D
 
Top