I’m trying to connect my cocos2dx android appliacation to facebook.
For that I use JNI and it works fine.
My problem is that I want to get a notnification when the facebook request is complete.
I want to send a a pointer to delegate function in cpp so the java part will call it when the request complete.
For example, in the login method (I chose to ask about the login but I want the same behavior for every method I use):
I have a cpp method, UserDidLogin() which I want to be called after user had logged in.
The java code should be something like that :
public static void login2Facebook()
Session.openActiveSession(me, true, new Session.StatusCallback()
// callback when session changes state
public void call(Session session, SessionState state, Exception exception)
mSession = session;
Request.executeMeRequestAsync(session, new Request.GraphUserCallback()
// callback after Graph API response with user object
public void onCompleted(GraphUser user, Response response)
if (user != null)
userInfo = user;
// *HERE I WANT TO CALL THE native UserDidLogin()\*
The current JNI call is:
Does anybody know how should I cahnge my code in order to achieve my goal?