We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto facebook = cocos2d::plugin::FacebookAgent::getInstance(); std::string permissions = "public_profile,user_friends"; facebook->login(permissions, [=](int ret, std::string& msg){ CCLOG("type is %d, msg is %s", ret, msg.c_str());
if (facebook->isLoggedIn()) { //Save access token auto accessToken = facebook->getAccessToken(); //Save user id auto id = facebook->getUserID(); }
}
ID here after first login comes to be empty.
Fix :
private class SessionStatusCallback implements Session.StatusCallback { @OverRide public void call(Session session, SessionState state, Exception exception) { onSessionStateChange(session, state, exception); if(false == isLoggedIn){ if(SessionState.OPENED == state){ isLoggedIn = true; // UserWrapper.onActionResult(mAdapter, UserWrapper.ACTION_RET_LOGIN_SUCCEED, getSessionMessage(session)); }else if(SessionState.CLOSED_LOGIN_FAILED == state /|| SessionState.CLOSED == state/){ UserWrapper.onActionResult(mAdapter, UserWrapper.ACTION_RET_LOGIN_FAILED, getErrorMessage(exception, "login failed")); }
} else{ if(SessionState.OPENED_TOKEN_UPDATED == state){ UserWrapper.onActionResult(mAdapter, UserWrapper.ACTION_RET_LOGIN_SUCCEED, getSessionMessage(session)); } else if(SessionState.CLOSED == state || SessionState.CLOSED_LOGIN_FAILED == state){ isLoggedIn = false; UserWrapper.onActionResult(mAdapter, UserWrapper.ACTION_RET_LOGIN_FAILED, getErrorMessage(exception, "failed")); } } } }
private void onSessionStateChange(final Session session, SessionState state, Exception exception) { if (session != null && session.isOpened()) { // make request to the /me API Request.newMeRequest(session, new Request.GraphUserCallback() { @OverRide public void onCompleted(GraphUser user, Response response) { LogD("User here"); if (user != null) { LogD("User here " + user.getId()); userIdStr = user.getId(); UserWrapper.onActionResult(mAdapter, UserWrapper.ACTION_RET_LOGIN_SUCCEED, getSessionMessage(session)); }
} }).executeAsync(); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
auto facebook = cocos2d::plugin::FacebookAgent::getInstance();
std::string permissions = "public_profile,user_friends";
facebook->login(permissions, [=](int ret, std::string& msg){
CCLOG("type is %d, msg is %s", ret, msg.c_str());
}
ID here after first login comes to be empty.
Fix :
private class SessionStatusCallback implements Session.StatusCallback {
@OverRide
public void call(Session session, SessionState state, Exception exception) {
onSessionStateChange(session, state, exception);
if(false == isLoggedIn){
if(SessionState.OPENED == state){
isLoggedIn = true;
// UserWrapper.onActionResult(mAdapter, UserWrapper.ACTION_RET_LOGIN_SUCCEED, getSessionMessage(session));
}else if(SessionState.CLOSED_LOGIN_FAILED == state /|| SessionState.CLOSED == state/){
UserWrapper.onActionResult(mAdapter, UserWrapper.ACTION_RET_LOGIN_FAILED, getErrorMessage(exception, "login failed"));
}
private void onSessionStateChange(final Session session, SessionState state,
Exception exception) {
if (session != null && session.isOpened()) {
// make request to the /me API
Request.newMeRequest(session, new Request.GraphUserCallback() {
@OverRide
public void onCompleted(GraphUser user,
Response response) {
LogD("User here");
if (user != null) {
LogD("User here " + user.getId());
userIdStr = user.getId();
UserWrapper.onActionResult(mAdapter, UserWrapper.ACTION_RET_LOGIN_SUCCEED, getSessionMessage(session));
}
The text was updated successfully, but these errors were encountered: