Build 1156 no longer crashes on Android, but I think there’s still an issue.
After showing and dismissing the facebook apprequests dialog, my facebook listener receives a callback, but event.response is empty. It seems like event.response isn’t nil but rather an empty string. As @jeremy039 noted above, on iOS, event.response contains information about the requests the user sent using the dialog in the format “fbconnect://success?request=XXXXXXXX&to%5B0%5D=YYYYYY”. I’d expect Android to do the same. (A separate question is why the information is in this format rather than JSON, but the more important issue is that the information isn’t even being provided on Android.)
I’m seeing the same behavior as aukStudios on build 1156. I’m properly getting a callback now but event.response is an empty string instead of the fbconnect URL.
This should be fixed in the next daily build. The docs were wrong in that the fbconnect.response always returns a json string. It only returns a json string when you do a facebook.request because that is what is returned by facebook. When you call facebook.showDialog we actually get back a uri instead. I will update the daily docs to reflect that fact.
Hi David, thanks for pushing out build 1157 before the long weekend. Unfortunately I’m still encountering a crash on Android.
After opening the apprequest dialog with facebook.showDialog, if I simply dismiss the dialog, my callback is fired and event.response is populated as expected (with “fbconnect://success”). However, if I use the dialog to actually send a request to another user, then immediately after tapping the send button in the dialog, the app crashes.
Yup, sorry about that, here’s the stack trace. I’m also including some lines from the log that appeared when the dialog was created, which looks like it might be relevant (particular the issue with the getString method).
07-04 17:27:43.681 1320 2103 W InputManagerService: Window already focused, ig noring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40 ae1ab8 07-04 17:27:44.009 7324 7324 I dalvikvm: Could not find method android.os.Bund le.getString, referenced from method com.ansca.corona.facebook.FacebookControlle r$FacebookWebDialogOnCompleteListener.onComplete 07-04 17:27:44.025 7324 7324 W dalvikvm: VFY: unable to resolve virtual method 672: Landroid/os/Bundle;.getString (Ljava/lang/String;Ljava/lang/String;)Ljava/ lang/String; 07-04 17:27:44.025 7324 7324 D dalvikvm: VFY: replacing opcode 0x6e at 0x0035 07-04 17:27:44.025 7324 7324 D dalvikvm: VFY: dead code 0x0038-003c in Lcom/an sca/corona/facebook/FacebookController$FacebookWebDialogOnCompleteListener;.onCo mplete (Landroid/os/Bundle;Lcom/facebook/FacebookException;)V 07-04 17:27:47.947 1320 1480 W InputManagerService: Window already focused, ig noring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40 a120f8 07-04 17:27:49.994 1320 2436 W InputManagerService: Window already focused, ig noring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40 9bd358 07-04 17:28:06.400 7324 7324 D AndroidRuntime: Shutting down VM 07-04 17:28:06.400 7324 7324 W dalvikvm: threadid=1: thread exiting with uncau ght exception (group=0x40018560) 07-04 17:28:06.400 7324 7324 D FlurryAgent: Ending session 07-04 17:28:06.423 7324 7324 E AndroidRuntime: FATAL EXCEPTION: main 07-04 17:28:06.423 7324 7324 E AndroidRuntime: java.lang.NoSuchMethodError: an droid.os.Bundle.getString 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at com.ansca.corona.face book.FacebookController$FacebookWebDialogOnCompleteListener.onComplete(FacebookC ontroller.java:176) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at com.facebook.widget.W ebDialog.sendSuccessToListener(WebDialog.java:225) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at com.facebook.widget.W ebDialog.access$200(WebDialog.java:52) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at com.facebook.widget.W ebDialog$DialogWebViewClient.shouldOverrideUrlLoading(WebDialog.java:312) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at android.webkit.Callba ckProxy.uiOverrideUrlLoading(CallbackProxy.java:223) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at android.webkit.Callba ckProxy.handleMessage(CallbackProxy.java:330) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at android.os.Handler.di spatchMessage(Handler.java:99) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at android.os.Looper.loo p(Looper.java:130) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at android.app.ActivityT hread.main(ActivityThread.java:3806) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at java.lang.reflect.Met hod.invokeNative(Native Method) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at java.lang.reflect.Met hod.invoke(Method.java:507) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at com.android.internal. os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at com.android.internal. os.ZygoteInit.main(ZygoteInit.java:597) 07-04 17:28:06.423 7324 7324 E AndroidRuntime: at dalvik.system.NativeS tart.main(Native Method)
Ok thanks for that. This seems like it should be an issue with 2.x devices for now. It should work on 3.x and 4.x devices. Unfortunately the office is closed until Monday, at that time I will fix this issue. Sorry for the inconvenience.
Hi guys, we have been pondering this problem for the past 2 days and thought I’d give some feedback. The tests have been made on 2 different Android devices (3.1 and 4.0). This is our experience so far…
Corona build 1168:
With Facebook App installed (v3.4)
Invoking facebook.login suspends the Corona app
Native Android alert saying “Facebook - xxxxx would like to access your public profile and friends list. OK | CANCEL”
Clicking OK resumes the Corona app
An empty “session” event is received by the facebook listener (no event.phase or token), i.e. the login FAILS
Without Facebook App installed
Invoking facebook.login suspends the Corona app
A browser based Facebook dialog appear, requesting user to login and granting permissions
After completing the dialogs, the Corona app resumes and crashes (“The application xxxxx has stopped unexpectedly. Please try again”)
Corona build 1131:
With Facebook App installed (v3.4)
invoking facebook.login suspends the Corona app
Facebook App asking for permission to access profile and friends list
After accepting permissions the Corona app resumes
A “session” event with event.phase and event.token is received by the facebook listener
Invoking facebook.showDialog(“apprequests”) summons the request dialog
Upon completing (or canceling) the dialog, the app continues normally, but:
An empty “dialog” event is received by the facebook listener. I.e. it’s not possible to verify the requests (as with IOS).
Edit: Cancelling the dialog fires an isError event with event.response set to"Dialog cancelled". This seems to be the only dialog event that actually generates a response.
Without Facebook App installed
The process is identical to the above except the login- and permission dialogs are browser based.
Example code:
local function fbListener( event ) if event.isError then -- handle error else if (event.type == "session") then if (event.phase == "login") then facebook.showDialog("apprequests"); end; elseif (event.type == "dialog") then -- handle dialog results end; end; end; facebook.login( FB\_APP\_ID, fbListener, {} ); -- no extended permissions needed
@Joel_DGS, that’s a really thorough report. I appreciate that. I filed a bug report (case #25128) about Facebook app issues on Android. I sent Corona support a follow up email, pointing to your post. I hope this whole thing will be looked at and resolved soon.
The issue with the Facebook dialog not providing a response to the callback listener was a bug that was resolved around Daily Build 1158. So I think that addresses the second part of your post, Joel. - Andrew
Hi guys, we have been pondering this problem for the past 2 days and thought I’d give some feedback. The tests have been made on 2 different Android devices (3.1 and 4.0). This is our experience so far…
Corona build 1168:
With Facebook App installed (v3.4)
Invoking facebook.login suspends the Corona app
Native Android alert saying “Facebook - xxxxx would like to access your public profile and friends list. OK | CANCEL”
Clicking OK resumes the Corona app
An empty “session” event is received by the facebook listener (no event.phase or token), i.e. the login FAILS
Without Facebook App installed
Invoking facebook.login suspends the Corona app
A browser based Facebook dialog appear, requesting user to login and granting permissions
After completing the dialogs, the Corona app resumes and crashes (“The application xxxxx has stopped unexpectedly. Please try again”)
Corona build 1131:
With Facebook App installed (v3.4)
invoking facebook.login suspends the Corona app
Facebook App asking for permission to access profile and friends list
After accepting permissions the Corona app resumes
A “session” event with event.phase and event.token is received by the facebook listener
Invoking facebook.showDialog(“apprequests”) summons the request dialog
Upon completing (or canceling) the dialog, the app continues normally, but:
An empty “dialog” event is received by the facebook listener. I.e. it’s not possible to verify the requests (as with IOS).
Edit: Cancelling the dialog fires an isError event with event.response set to"Dialog cancelled". This seems to be the only dialog event that actually generates a response.
Without Facebook App installed
The process is identical to the above except the login- and permission dialogs are browser based.
Example code:
local function fbListener( event ) if event.isError then -- handle error else if (event.type == "session") then if (event.phase == "login") then facebook.showDialog("apprequests"); end; elseif (event.type == "dialog") then -- handle dialog results end; end; end; facebook.login( FB\_APP\_ID, fbListener, {} ); -- no extended permissions needed