[TIMOB-2056] Android: Second launch of app keeps Facebook session logged in but FB Connect dialog shows empty
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2011-04-15T03:09:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Backlog |
Components | Android |
Labels | android, defect, facebook |
Reporter | Bill Dawson |
Assignee | Bill Dawson |
Created | 2011-04-15T03:09:10.000+0000 |
Updated | 2017-03-02T19:25:40.000+0000 |
Description
app.js:
/*global Ti, Titanium, alert, JSON */
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({
title:'Test',
backgroundColor:'#fff',
exitOnClose: true
});
var fbButton = Titanium.Facebook.createLoginButton({
'style':'wide',
'apikey':'9494e611f2a93b8d7bfcdfa8cefdaf9f',
'sessionProxy':'http://api.appcelerator.net/p/fbconnect/',
bottom:10
});
win.add(fbButton);
var status = Ti.UI.createButton({
title:'Publish Status', width:200, height:40, top:60
});
win.add(status);
status.addEventListener('click', function()
{
if (!Titanium.Facebook.isLoggedIn())
{
Ti.UI.createAlertDialog({title:'Facebook', message:'Login before publishing to your stream'}).show();
return;
}
Titanium.Facebook.publishStream("Set your status",null,null,function(r)
{
if (r.success)
{
Ti.UI.createAlertDialog({title:'Facebook', message:'Your status was published'}).show();
}
else
{
Ti.UI.createAlertDialog({title:'Facebook', message:'You canceled, or there was an error'}).show();
}
});
});
win.open();
Steps to reproduce:
-
Launch this app.js.
-
Use the "Connect with Facebook" button to login to Facebook.
-
After you have successfully logged in, go back to Ti Developer and re-launch the application. (You don't need to click the "Publish Status" button at all in this round.
-
When the application re-launches, you should see that you are still logged into Facebook (the blue Facebook button will say "logout" instead of "Connect with Facebook" -- i.e., you are still logged in.)
-
Now click the "Publish Status" button. An empty Facebook Connect view will show up instead of the expected view which should show you fields in which to type and submit your status.
Attachments
File | Date | Size |
---|---|---|
2056_1_4_x.diff | 2011-04-15T03:09:11.000+0000 | 3993 |
Attached .diff to help with logging. Haven't committed any of this yet.
I could overcome this problem by erasing the activity cookies in FacebookModule.executeLogin.I also unsave the session so that if another user will log in, it will be asked for credentials.
CookieSyncManager.createInstance(activity);
CookieSyncManager csm = CookieSyncManager.getInstance();
CookieManager cm = CookieManager.getInstance();
cm.removeAllCookie();
csm.sync();
session.unsave(activity);
After this I still had a FileNotFoundException when loading https://graph.facebook.com/me?var=val&...&method=me">https://graph.facebook.com/me?var=val&...&method=me. It worked for me after commenting out the following line on FBRequest.java (method callWithAnyData() )
mParams.put("method", mMethod);
Hope this may be of help
With the Titanium 1.6.0 changes to the facebook module, the equivalent code for the above test case would now be:
I cannot re-create the failcase with the new Facebook module, so I'll mark this as "invalid" (though it was not originally invalid) to close it.
@Leo Acevedo: regarding destroying FB sessions, you might be interested in the approached described in #3025.
@Bill Dawson: indeed, it would have been great to know this in advance, thanks a lot :)
Closed as invalid.