I’m trying to call FB autorize dialog with this code:
//return true if is autologged
//return false if facebook login dialog is called
public boolean LoginAsync(Activity act)
{
m_strLastError="";
boolean bTryLogin= true;
if ((m_fbkey != null) && (m_fbkey.length() > 0))
{
facebook.setAccessToken(m_fbkey);
bTryLogin = !facebook.isSessionValid();
}
if (bTryLogin)
{
facebook.authorize(act, new String[] { "email", "offline_access", "publish_stream", "read_stream"}, new LoginDialogListener());
return false;
}
//"succesfull 'autologin'
return true;
}
It worked fine in test app when click button, but stopped working when moved it to OnCreate.
Dialog doesn’t appear anymore. Only empty screen.
Is it possible to fajl because of use in OnCreate?
If you call login and have a valid token then you will skip the login form and go straight to the onComplete callback.
http://facebook.stackoverflow.com/questions/9130133/authorize-method-called-twice-for-facebook-on-android
Thanks to mcnicholls.