• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android Authorization in Facebook does not occur

S

Schekhovtsov

Guest
Hello!

Installed the Facebook extension according to this guide - https://help.yoyogames.com/hc/en-us/articles/360004488072-iOS-Android-and-HTML5-Integrating-Facebook

Facebook also seems to have configured everything in the developer’s console. In the GMS2 settings inserted the game data from the developer's console (for the extension to work).

I inserted the authorization code into the button in the game. When clicked, the Facebook authorization window opens (I'm already logged in, so in this form).


When you click OK, the window closes. A pop-up message that should indicate a successful authorization does not appear. There is no connection.

At the same time, a message appeared that the SDK in the game is out of date.


Update instructions, as I understand it, are not very suitable for GMS - https://developers.facebook.com/docs/app-events/upgrade-guide/

Maybe authorization does not occur because of this (low version SDK), maybe doesn't, but I have no idea how to update Facebook SDK (This is an extension, after all!)

Thanks in advance for your help.
 
Last edited by a moderator:
S

Schekhovtsov

Guest
So. Something seems to work. Facebook analytics shows numbers (though a bit strange. For example, 4 unique users, when a maximum of 2 is possible). It turns out, mb connection status check is not working?
 
Last edited by a moderator:

pipebkOT

Member
@Schekhovtsov
If you are using show_debug_message . No pop-up message would appear.

This function is for testing mode only.
Not compiled apks, and the messages would appear in the adb window.

Try using testing mode and read what the adb window show when you try to call the Facebook functions, so you can know what the problem is.


to update the sdk version, you need open the extension in the resource tree and right click on extra platforms "android" and in the inyect to gradle dependencies change the sdk version, but since i don't know how extensions work, i don't know if this could break the extension or not.
 
Last edited:
S

Schekhovtsov

Guest
@Schekhovtsov

to update the sdk version, you need open the extension in the resource tree and right click on extra platforms "android" and in the inyect to gradle dependencies change the sdk version, but since i don't know how extensions work, i don't know if this could break the extension or not.
I tried it. Just changing the numbers doesn't help.

Please, check adb log. Maybe you can find a problem?
 

pipebkOT

Member
@Schekhovtsov When I said adb window I meaned the output/compiling window , sorry. Try running the game in test mode and check the output/compiling window
For any error. Or debug messages
 
Last edited:
S

Schekhovtsov

Guest
@pipebkOT

Now It seems to me that the problem is in the Facebook developer console. I found such a line in the logs.



It seems that the Android platform has not been added to the console. And so it is! The App Domains glows red, and because of this, the Android platform has not been added. I deleted the App Domains and the Android platform was saved! According to the instructions there should be the URL of the game in the store:
  • App Domains - Provide Google Play and/or Apple App Store URL of your app.
But he doesn’t like it. I tried the name of the package. He also swears.

 
Last edited by a moderator:
S

Schekhovtsov

Guest
Authorization seems to be successful!

P.S. App Domain field is empty
 
S

Schekhovtsov

Guest
One more question. The following check was made - after authorization, the button for authorization disappears.

That is, when you click on the button, authorization is successfully performed.



After restarting the game, the button is again visible, apparently there is no automatic connection to Facebook. But should this happen? Actually, what is required: do not display the authorization button if it has already been performed once.


Code:
//Facebook
switch (async_load[? "type"])
{
case "facebook_login_result":
show_debug_message("facebook_login_result async event triggered");
if async_load[? "status"] == "success"
{
if !fb_logged_in
{
fb_logged_in = true;
show_debug_message("User successfully logged in!");
for (var i = 0; i < ds_list_size(fb_permissions); ++i;)
{
var _key = fb_permissions[| i];
if ds_map_exists(async_load, _key)
{
if async_load[? _key] == "granted"
{
show_debug_message("Permission " + _key + ": granted");
}
else show_debug_message("Permission "+_key + ": "+async_load[? _key]);
}
else show_debug_message("Permission " + _key + ": Does Not Exist");
}
}
}
else show_debug_message("Login failed: " + string(async_load[? "status"]));
break;

case "fb_graph_request":
show_debug_message("fb_graph_request async event triggered");
if async_load[? "status"] == "success"
{
show_debug_message("Graph Request Successful!");
var _text = async_load[? "response_text"];
var _response = json_decode(_text);
show_debug_message("Response = " + string(_response));
fb_username = _response[? "name"];
fb_userid = _response[? "id"];
var _pic_map = _response[? "picture"]
var _data_map = _pic_map[? "data"];
fb_picture = sprite_add(_data_map[? "url"], 0, false, false, 0, 0);
}
else
{
if async_load[? "status"] == "error"
{
show_debug_message("Graph Request Error!");
show_debug_message("Exception = " + string(async_load[? "excepton"]));
}
else
{
show_debug_message("Graph request Cancelled!");
}
}
break;
}

Code:
//Facebook
fb_init();
fb_logged_in = false;
fb_userid = "";
fb_username = "";
fb_picture = -1;
fb_login_default = noone;
fb_permissions = ds_list_create();
ds_list_add(fb_permissions, "public_profile", "user_friends");
 
Last edited by a moderator:

pipebkOT

Member
@Schekhovtsov
Like everything else in your game, you need to save variables in a ini file or something else.
Then load the variable at the start of the game

You need to save the fb_logged_in variable, then make a if check in the login_button
 
Top