How can I replace facebook:isSessionConnected() with facebook:getAccessToken() == "" in this new version?
I was using isSessionConnected previous Facebook SDK to check if user was connected and do not show the login button. But now the first time it returns "" as access token.
I just put a facebook icon down and if there was a previous login, do a login - I then hide the icon on the login completed event. If the icon is pressed then I have a go logging in and set the setting to try login on startup next time. In options I have a login in not logged in and a logout if logged in (the logout will clear the auto login setting).
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
I just put a facebook icon down and if there was a previous login, do a login - I then hide the icon on the login completed event. If the icon is pressed then I have a go logging in and set the setting to try login on startup next time. In options I have a login in not logged in and a logout if logged in (the logout will clear the auto login setting).
My problem is how to check if there was a previous login when app starts. If I do facebook:login() and user is not connected it will show facebook login page. But I prefer that user push login button if he is not connected.
I assume you use datasaver.lua or similar functionality to store settings on disk then and to know if next time go logging must be done on startup.
After the facebook icon is pressed and logon successful then save a file called facebook with a value of one. Check if 1 at startup then log on automatically.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
I guess changes on java code will be something like:
public static long getExpirationDateAsString(){if(Session.getActiveSession()!= null)return(long)Session.getActiveSession().getExpirationDate();return0;}
@jdbc latest version already provides facebook:getAccessToken() and facebook:getExpirationDate() on expriation date returned as number and can be formated after in lua using os.date http://www.lua.org/pil/22.1.html
@jdbc latest version already provides facebook:getAccessToken() and facebook:getExpirationDate() on expriation date returned as number and can be formated after in lua using os.date http://www.lua.org/pil/22.1.html
I was linked facebook and parse user using authData as Parse documentation explains. This is my code:
ParseAPI = Core.class()local base_url ="<a href="https://api.parse.com"" rel="nofollow">https://api.parse.com"</a>;
local headers = {
["X-Parse-Application-Id"] = "Your Parse App Id",
["X-Parse-REST-API-Key"] = "Your REST API Key",
["Content-Type"] = "application/json"
}
require "json"
-- Parse login using authData
function ParseAPI.login()
local url = base_url.."/1/users"
local method = UrlLoader.POST
local data = {}
local authData = {}
local token = {
id = social.userid,
access_token = social.accessToken,
expiration_date = "2014-06-01T17:44:46.000"
}
authData.facebook = token
data.authData = authData
local body = json.encode(data)
print("body", body)
local loader = UrlLoader.new(url, method, headers, body)
local function onComplete(event)
print("onComplete", event.data)
end
local function onError()
print("onError")
end
local function onProgress(event)
print("onProgress: ")
end
loader:addEventListener(Event.COMPLETE, onComplete)
loader:addEventListener(Event.ERROR, onError)
loader:addEventListener(Event.PROGRESS, onProgress)
end
Next I will try to convert facebook:expirationDate() to some String like ""2014-06-01T17:44:46.000"
Hmm thats what I had here also But it does not make any sense. Currently I don't know a situation where there won't be an activity in weakholder.
Either you call login even before application onCreate was called, which is impossible or call login after application was destroyed. Which is also impossible
@anunesezlearn ah I see, it could be possible if, you did not include GFacebook as external class in main activity, thus it does not receive the reference to activity
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
I'm sure though I could do this with the existing code. It was just an idea for others to do the same.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@jdbc if you download the latest facebook version from Gideros Labs, it should support Graph API 2.0
I have tested with Gideros Facebook 0.3, I will try with version 0.6
It seems some behaviour have been changed in Graph API 2.0. For example when you call to facebook:getFriends(), it only returns friends using game. Previous Graph API version returns all your friends.
I need to use invite_friends feature to submit invitations between friends, two days of Animal Wild Rescue and 600 downloads on IOs should become x4 using invitation with gifts.
i attach my lua code for Facebook social integration
local params ={
title = appName.." request",
message ="Check out this awesome app",
}
facebook:inviteFriends(params)
I can invite friends with a multiselector "apprequest"
Anyway I do not know how to manage Event.DIALOG_COMPLETE callback to retrieve Facebook userid's in order to know how many and which friends have been invited.
@jdbc yes unfortunately now facebook prohibits that. You can only get info about users that use your app and they ids are will be only your app specific (you won't get normal ids anymore, only some generated once that will be specific to your app, not across all apps), so until someone joined your app, they actually have no ID.
Quoting:
User IDs are now scoped to the calling app and can't be used in other apps.
You need to read all app requests for user upon login You need to delete each app request after processing it, so it won't be processed again.
So existing user sends an app request to none approved user. It works as invite. You can provide the message as Invite you blabla. And set data field to some value as invite, so you would know this request is to invite.
Once the none approved user joins your app, you read its app requests, and you see that existing user sent him a request with data as invite. Then you go credit this user for inviting and delete this app request. If multiple users have invited this new user, you either credit all of them or compare created_time field to know who was the first.
Same thing with sending lives and hearts or bonuses to each other.
User sends other user a heart or a bonus, you store all the data you need in data field (up to 255 characters) and the when other user logs in, check the requests and display the message, accept, delete, ignore. On accept credit the bonus to user and offer to send one back and delete request On delete simply delete request On ignore, do nothing and same request will be displayed next time you load the user or on push of specific button, etc
I'm using your new lib though - I get exactly the same IDs as I did before - not new iDs specifically for the app. Or is this just new users of the app?
The data stuff looks good. You need more tutorials with the labs libs.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Comments
I was using isSessionConnected previous Facebook SDK to check if user was connected and do not show the login button. But now the first time it returns "" as access token.
https://deluxepixel.com
I assume you use datasaver.lua or similar functionality to store settings on disk then and to know if next time go logging must be done on startup.
https://deluxepixel.com
local file=io.open("|D|"..en("facebook.txt"),"w+")
if file then
file:write("1")
file:close()
end
The en("xxxx") just encrypts the filename - so they don't know what is going on if they try look at the files.
Likes: jdbc
https://deluxepixel.com
It is possible to provide Parse linking integration (https://parse.com/docs/rest#users-linking)? I was testing Parse using facebook users.
I guess changes on java code will be something like:
on expriation date returned as number and can be formated after in lua using os.date
http://www.lua.org/pil/22.1.html
Likes: jdbc
04-11 00:27:27.141: E/AndroidRuntime(31511): java.lang.NullPointerException
04-11 00:27:27.141: E/AndroidRuntime(31511): at com.giderosmobile.android.plugins.facebook.GFacebook.login(GFacebook.java:89)
Did I miss something?
Because it might have changed from version to version
if(permissions != null)
PERMISSIONS = (String[])permissions;
SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder()
.setAppId(appId)
.setPermissions(PERMISSIONS)
.build();
SimpleFacebook.setConfiguration(configuration);
//89--> sActivity.get().runOnUiThread(new Runnable() {
@Override
public void run() {
sfb.login(new LoginCallback());
}
});
}
sActivity = new WeakReference(activity);
But it does not make any sense.
Currently I don't know a situation where there won't be an activity in weakholder.
Either you call login even before application onCreate was called, which is impossible
or call login after application was destroyed. Which is also impossible
Is there anything specific in your lua code?
Do you have a something like:
https://developers.facebook.com/blog/post/2012/08/21/bringing-mention-tagging-to-open-graph/
https://deluxepixel.com
Likes: SinisterSoft
https://deluxepixel.com
Is this feature provided?
I assume this is a very important feature for viral marketing using Facebook friends.
It seems some behaviour have been changed in Graph API 2.0. For example when you call to facebook:getFriends(), it only returns friends using game. Previous Graph API version returns all your friends.
I need to use invite_friends feature to submit invitations between friends, two days of Animal Wild Rescue and 600 downloads on IOs should become x4 using invitation with gifts.
i attach my lua code for Facebook social integration
I have configured my app as Android in settings web page.
https://developers.facebook.com/docs/games/invitable-friends/v2.0
https://developers.facebook.com/docs/games/requests/v2.0
Anyway I do not know how to manage Event.DIALOG_COMPLETE callback to retrieve Facebook userid's in order to know how many and which friends have been invited.
You can only get info about users that use your app and they ids are will be only your app specific (you won't get normal ids anymore, only some generated once that will be specific to your app, not across all apps), so until someone joined your app, they actually have no ID.
Quoting:
You need to read all app requests for user upon login
You need to delete each app request after processing it, so it won't be processed again.
So existing user sends an app request to none approved user. It works as invite. You can provide the message as Invite you blabla. And set data field to some value as invite, so you would know this request is to invite.
Once the none approved user joins your app, you read its app requests, and you see that existing user sent him a request with data as invite. Then you go credit this user for inviting and delete this app request.
If multiple users have invited this new user, you either credit all of them or compare created_time field to know who was the first.
Same thing with sending lives and hearts or bonuses to each other.
User sends other user a heart or a bonus, you store all the data you need in data field (up to 255 characters) and the when other user logs in, check the requests and display the message, accept, delete, ignore.
On accept credit the bonus to user and offer to send one back and delete request
On delete simply delete request
On ignore, do nothing and same request will be displayed next time you load the user or on push of specific button, etc
Likes: jdbc
The data stuff looks good. You need more tutorials with the labs libs.
https://deluxepixel.com