facebook.showDialog() doesn't return a response on Android (but does in iOS)

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)
  • Andrew

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.

OK thanks Danny (I don’t know what I was saying David!), sounds good.  Have a great weekend.

  • Andrew

dchan: Build 1157 fixes it for me, but then again, I’ve only tested it on my Nexus 7. Thanks for the quick turnaround and making this fix happen!

Cool, dchan’s point is probably right then, since I was using a device running Android 2.x.

  • Andrew

Hi,

I’ve pushed a fix and it should appear in build 1158.

Hi Danny.  It’s working for me now in build 1158.  Thanks for turning this around!

  • Andrew

I’m getting this as well. Works absolutely fine on iOS, but on Android the “dialog” event type for the facebook response listener doesn’t come through.

Anyone else experiencing this?

Hi,

Can you guys try “requests” instead of “apprequests”?  If its what you expect then we’ve mapped the requests wrong and will change it accordingly.  Thanks.

Sorry I should’ve been more specific, I’m using “feed” and experiencing the problem, like so:

facebook.showDialog( "feed", { name = "", description = "", link = "" })

The dialog is opened properly, but the dialog event type isn’t coming back from facebook.

Thanks for the response! I replaced “apprequests” with “requests” and still don’t get a response in my facebook listener function.

I’m also having the same problem as timjonrichardson with the “feed” dialog as well.

Don’t suppose there is an update on this?

I am experiencing this same issue. iOS implementation works as expected, but there is absolutely no callback (or anything showing up in logcat) for android. Please push this up in priority.

For your debug purposes:

[lua]

facebook.login( “XXXXXXXXXXX”, friendListener, {“publish_stream”} )

function friendListener(event)

    print("Any JSON: " … json.encode(event))

    if ( “session” == event.type ) then

        if ( “login” == event.phase ) then

            facebook.showDialog(“apprequests”, {title=“Send to some friends”,message=“Check this out”})

        end

    elseif ( “dialog” == event.type) then

         print( event.response )        

    end

end

[/lua]

  1. Login is successful and Any JSON prints to logcat

  2. Dialog shows and friends are selectable, pressing send works.

  3. Any JSON is never called again (for the dialog response)


Additional note for apple:

4. Any JSON is called again for dialog, but event.response is the fbconnect:// command and not usable json feedback like most facebook.request returns.

fbconnect://success?request=XXXXXXXX&to%5B0%5D=YYYYYY

Is this in error? Do we have to write our own decoder for this return if we want to know the friend ids?

Hi,

Thanks for the information.  I’ll look into this today.

This should be fixed in build 1154.

Awesome, great turnaround time, thanks! I’ll give it a whirl when build 1154 comes out.

So I tried build 1154 with the sample code I originally posted and it looks like I actually get a crash now after I select a friend and press “Send”. The message, “Unfortunately, fbtest has stopped” pops up. This is the output in adb logcat:

D/AndroidRuntime( 4672): Shutting down VM W/dalvikvm( 4672): threadid=1: thread exiting with uncaught exception (group=0x40f03930) E/AndroidRuntime( 4672): FATAL EXCEPTION: main E/AndroidRuntime( 4672): java.lang.NullPointerException E/AndroidRuntime( 4672):     at com.ansca.corona.facebook.FacebookController$FacebookWebDialogOnCompleteListener.onComplete(FacebookController.java:173) E/AndroidRuntime( 4672):     at com.facebook.widget.WebDialog.sendSuccessToListener(WebDialog.java:225) E/AndroidRuntime( 4672):     at com.facebook.widget.WebDialog.access$200(WebDialog.java:52) E/AndroidRuntime( 4672):     at com.facebook.widget.WebDialog$DialogWebViewClient.shouldOverrideUrlLoading(WebDialog.java:312) E/AndroidRuntime( 4672):     at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:270) E/AndroidRuntime( 4672):     at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:372) E/AndroidRuntime( 4672):     at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 4672):     at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime( 4672):     at android.app.ActivityThread.main(ActivityThread.java:5041) E/AndroidRuntime( 4672):     at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 4672):     at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime( 4672):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/AndroidRuntime( 4672):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime( 4672):     at dalvik.system.NativeStart.main(Native Method) W/ActivityManager(  443):   Force finishing activity com.freetherobots.shadowarc/com.ansca.corona.CoronaActivity I/InputReader(  443): Reconfiguring input devices.  changes=0x00000004 I/InputReader(  443): Device reconfigured: id=2, name='elan-touchscreen', size 800x1280, orientation 0, mode 1, display id 0  

I am receiving the same error with build 1154–using my above posted code for “apprequests” immediately following hitting the send button on the dialog.

W/System.err(17755): java.lang.NullPointerException

W/System.err(17755):     at com.ansca.corona.facebook.FacebookController$FacebookWebDialogOnCompleteListener.onComplete(FacebookController.java:173)

W/System.err(17755):     at com.facebook.widget.WebDialog.sendSuccessToListener(WebDialog.java:225)

W/System.err(17755):     at com.facebook.widget.WebDialog.access$200(WebDialog.java:52)

W/System.err(17755):     at com.facebook.widget.WebDialog$DialogWebViewClient.shouldOverrideUrlLoading(WebDialog.java:312)

W/System.err(17755):     at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:336)

W/System.err(17755):     at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:461)

W/System.err(17755):     at android.os.Handler.dispatchMessage(Handler.java:99)

W/System.err(17755):     at android.os.Looper.loop(Looper.java:137)

W/System.err(17755):     at android.app.ActivityThread.main(ActivityThread.java:4895)

W/System.err(17755):     at java.lang.reflect.Method.invokeNative(Native Method)

W/System.err(17755):     at java.lang.reflect.Method.invoke(Method.java:511)

W/System.err(17755):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)

W/System.err(17755):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)

W/System.err(17755):     at dalvik.system.NativeStart.main(Native Method)

Like @allbymyself and @jeremy039, I’m also getting a crash when using facebook.showDialog (the apprequests dialog) on Android in daily build 1154, but not in daily build 1153.  The crash occurs regardless of whether I actually send a request via the dialog or simply cancel out of the dialog after it displays.  (iOS continues to work fine.)

@dchan, since three of us are experiencing this, it looks like the fix that was pushed in daily build 1154 isn’t working.

  • Andrew

Hey,

Sorry about that guys.  Please try 1155 and see if that works.