Closed devloe closed 10 years ago
@devyanlab, Hi, Did you check api_demos project? I think you can just copy code from there, it already contains all what you need. Just check login demo, in it I enable/disable buttons if user is logginned or not.
Thats what im doing. The thing is that I dont get when is the right time to call isConnected()
.
If I setup a Hanlder with a timeout of 2 seconds, and execute isConnected()
, then I get `true. Otherwise, I get
false``.
Thats really strange, here is implementation of isConnected()
:
@Override
public boolean isConnected() {
String accessToken = mSharedPreferences.getString(SAVE_STATE_KEY_OAUTH_TOKEN, null);
String accessTokenSecret = mSharedPreferences.getString(SAVE_STATE_KEY_OAUTH_SECRET, null);
return accessToken != null && accessTokenSecret != null;
}
I can't understand how you can get false, if you really connected. This is implementation for Twitter and LinkedIn, for Facebook it's different, are we talking about Facebook?
I get false
right after initializing SocialNetworkManager
. If I call isConnected()
2 seconds after that, I get true
.
And i'm testing it with Google+.
Nevermind. I don't need to do that anymore, I took another path.
Anyways, it is really strange tho.
@devyanlab, I need to double check this, as I just call isConnected
from Google Plus client:
@Override
public boolean isConnected() {
return mPlusClient.isConnected();
}
What's the best moment to call
.isConnected()
?Calling it inside
onSocialNetworkManagerInitialized()
always returnsfalse
.On the other hand, I find it hard to understand the correct flow. This is what I plan to do:
SocialNetworkManager
isConected()
(where?).requestLogin()
requestLogin()
has done, callrequestCurrentPerson()
to get profile info. Then save the email or whatever to a database (php/mysql in my case) and register the user.Is this reasoning ok to you?
Anyway, the library is awesome.