{ "id": "91066", "key": "AC-2842", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2012-05-25T16:31:07.000+0000", "created": "2012-04-30T10:17:29.000+0000", "labels": [ "android", "defect" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:47:47.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "When calling Ti.Facebook.authorize(); the login event no longer fires for successful logins on android emulator or devices. IOS still allows handlers to attach to the event.\r\n\r\nCurrently I am using a setTimeout loop as a workaround for android devices and I test against the accessToken until I get it. Obviously this is not a desirable solution.", "attachment": [], "flagged": false, "summary": "Facebook Login event doesn't fire for Android devices.", "creator": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Android Emulator Titanium SDK 1.8.1 / 2.0.1GA2", "comment": { "comments": [ { "id": "193253", "author": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Could you please provide me a sample test case?", "updateAuthor": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-30T22:32:48.000+0000", "updated": "2012-04-30T22:32:48.000+0000" }, { "id": "193283", "author": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "//Set's values we have stored (we're using 'email' for permissions)\r\nTi.Facebook.appid = ef.facebookData.appid;\r\n\tTi.Facebook.permissions = ef.facebookData.permissions;\r\n\t\r\n\tTi.Facebook.addEventListener('login',function(e){\r\n\t if (e.success) {\r\n\t\t\tvar loadingSpinner = loadingJS.loadView(ef, winLogin, L('loggingIn'));\r\n\t\t\tloadingSpinner.show();\r\n\t\t\tfacebookLoginLogic.run(ef, false, winLogin, loadingSpinner,Ti.Facebook.accessToken);\r\n\t } else if (e.error) {\r\n\t alert(e.error);\r\n\t } else if (e.cancelled) {\r\n\t return;\r\n\t }\t \r\n\t});\r\n\r\n//Button provider returns a more or less standard button with our custom colors and styling built in.\r\nvar btnFacebook = buttonProvider.createButton(ef,{\r\n\t\ttitle: L('facebookLogin'),\r\n\t\tclickHandler: function(){\r\n\t\t\tTi.Facebook.authorize();\r\n\t\t}\r\n\t});\r\n\tviewContainer.add(btnFacebook.Button);", "updateAuthor": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-01T08:46:24.000+0000", "updated": "2012-05-01T08:46:24.000+0000" }, { "id": "193284", "author": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "In this sample you could remove our code from the login event listener. The important thing is that it doesn't fire after authorize on android. Even reducing this to a very simple test case. I tried various iterations (using facebook button, different SDKs, etc...) and it just doesn't work.", "updateAuthor": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-01T08:48:01.000+0000", "updated": "2012-05-01T08:48:01.000+0000" }, { "id": "193285", "author": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Actually another bug which I am encountering is that the username and password are somehow cached on android only so if I log out using the facebook object the next time I log in I can't enter a different username and password (the window immediately closes and just logs in). This doesn't happen on iphone.\r\n\r\nShould I enter this as a separate bug or can it be addressed here? Is there a way to clear out the user information from within my app code in addition to logging out?", "updateAuthor": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-01T08:50:46.000+0000", "updated": "2012-05-01T08:50:46.000+0000" }, { "id": "193446", "author": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "An update on this:\r\n\r\nAnother developer here did some work to post a more comprehensive code sample in regards to this issue. What he found was that neither issue presented itself in the simple test case he created.\r\n\r\nHe then gradually tried emulating our application and login page more and more to see what specifically caused the issue to occur. We're part of the way there.\r\n\r\nSo far we know that if we transplant tiapp.xml over it has no bearing on the issue and that the facebook login works correctly when added to the loading screen in our main app. It is something about the screen itself that is linked to the bug. It does contain a scroll view and has some orientation changing code. We'll try to pair it down even more closely and we might be able to identify a more clear bug for you for instance 'Placing a facebook login on a screen with a scroll view breaks on android'. However we're not there yet.", "updateAuthor": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-02T10:46:46.000+0000", "updated": "2012-05-02T10:46:46.000+0000" }, { "id": "193871", "author": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm sending a code snippet \r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor:'red'\r\n});\r\nvar login = Titanium.Facebook.createLoginButton({\r\n\ttop: 10, style:'wide'\r\n});\r\nwin.add(login);\r\nTitanium.Facebook.appid = \"134793934930\";\r\nTitanium.Facebook.permissions = ['publish_stream', 'read_stream'];\r\nTi.Facebook.addEventListener('login', function(e) {\r\n if (e.success) {\r\n alert('Logged In');\r\n } else if (e.error) {\r\n alert(e.error);\r\n } else if (e.cancelled) {\r\n alert(\"Canceled\");\r\n }\r\n});\r\nTi.Facebook.authorize();\r\nwin.open();\r\n{code}\r\nPlease try to run the above code in your app.js and you'll get an alert('Logged In') after authorize on android. Also refer the kitchen Sink application click Mashups tab to get to facebook.", "updateAuthor": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-04T17:42:32.000+0000", "updated": "2012-05-04T17:42:32.000+0000" }, { "id": "193989", "author": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Paul, our other Appcelerator developer here, found some more information on this issue through some thoughtful trial and error.\r\n\r\nSpecifically, the facebook login will not work on Android when the window it is run on has the exitOnClose property set to true. We're using a variant of NavigationController.js and currently our 'root' windows (which login happens to be) have this property set to true by default.\r\n\r\nWe're going to try to alter our code to work around this issue now that we know what it is, but I wanted to make sure I accurately reported the link we are seeing.\r\n\r\nTo be clear, we've tried variations of the code you pasted above. It's not a matter of exactly replicating the facebook login examples. It seems that it simply won't work correctly if you have exitOnClose set to true on the window you are running the facebook login code off of and it will if you don't.\r\n\r\nI hope that provides helpful info into looking into this further!\r\n\r\n", "updateAuthor": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-07T12:39:12.000+0000", "updated": "2012-05-07T12:39:12.000+0000" }, { "id": "193992", "author": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "A small correction on the above summary of the issue.\r\n\r\nIt's actually specifically when a window with this property (exitOnClose) set to true is closed, but the app continues running for whatever reason. From that point forward the facebook login will always fail on Android.\r\n\r\nIt's probable we are/were doing something a little wacky with our code to have that property set. We'll fix it, but just wanted to get the facts straight in case someone else is having a similar problem.", "updateAuthor": { "name": "mlyon@gavant.com", "key": "mlyon@gavant.com", "displayName": "Miles Lyon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-07T12:47:51.000+0000", "updated": "2012-05-07T12:47:51.000+0000" }, { "id": "196162", "author": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Couldn't reproduce it.", "updateAuthor": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-25T16:31:07.000+0000", "updated": "2012-05-25T16:31:07.000+0000" }, { "id": "286327", "author": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Checked on Android. FB login works fine with the latest build of the TISDK. Not a bug. Therefore, closing it.", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-12-31T03:23:15.000+0000", "updated": "2013-12-31T03:23:15.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }