Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

appInvite crash on Android (only when triggered back-button or hit X) #63

Closed
hirbod opened this issue Oct 6, 2015 · 7 comments
Closed

Comments

@hirbod
Copy link
Collaborator

hirbod commented Oct 6, 2015

@jeduan, app will crash.

Newest Version installed. I'm on Crosswalk (Don't think that this is related)

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64213, result=-1, data=Intent { (has extras) }} to activity {net.nachbarschaft/net.nachbarschaft.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.error(org.json.JSONObject)' on a null object reference
E/AndroidRuntime( 4007):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3539)
E/AndroidRuntime( 4007):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3582)
E/AndroidRuntime( 4007):    at android.app.ActivityThread.access$1300(ActivityThread.java:144)
E/AndroidRuntime( 4007):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1327)
E/AndroidRuntime( 4007):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 4007):    at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 4007):    at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 4007):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 4007):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 4007):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 4007):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime( 4007): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.error(org.json.JSONObject)' on a null object reference
E/AndroidRuntime( 4007):    at org.apache.cordova.facebook.ConnectPlugin.handleError(ConnectPlugin.java:724)
E/AndroidRuntime( 4007):    at org.apache.cordova.facebook.ConnectPlugin.access$300(ConnectPlugin.java:52)
E/AndroidRuntime( 4007):    at org.apache.cordova.facebook.ConnectPlugin$6.onCancel(ConnectPlugin.java:223)
E/AndroidRuntime( 4007):    at com.facebook.share.widget.AppInviteDialog$1.onSuccess(AppInviteDialog.java:147)
E/AndroidRuntime( 4007):    at com.facebook.share.internal.ShareInternalUtility.handleActivityResult(ShareInternalUtility.java:174)
E/AndroidRuntime( 4007):    at com.facebook.share.widget.AppInviteDialog$2.onActivityResult(AppInviteDialog.java:157)
E/AndroidRuntime( 4007):    at com.facebook.internal.CallbackManagerImpl.onActivityResult(CallbackManagerImpl.java:82)
E/AndroidRuntime( 4007):    at org.apache.cordova.facebook.ConnectPlugin.onActivityResult(ConnectPlugin.java:251)
E/AndroidRuntime( 4007):    at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:120)
E/AndroidRuntime( 4007):    at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:353)
E/AndroidRuntime( 4007):    at android.app.Activity.dispatchActivityResult(Activity.java:6135)
E/AndroidRuntime( 4007):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3535)
E/AndroidRuntime( 4007):    ... 10 more
W/ActivityManager(  733):   Force finishing activity net.nachbarschaft/.MainActivity
@hirbod
Copy link
Collaborator Author

hirbod commented Oct 6, 2015

Commenting out

https://github.com/jeduan/cordova-plugin-facebook4/blob/master/src/android/ConnectPlugin.java#L222-L223

and

https://github.com/jeduan/cordova-plugin-facebook4/blob/master/src/android/ConnectPlugin.java#L228-L229

will fix the crash. Seems like the function "handleError" isn't safe enough for validating the result. I guess you need to call the return directly, like I did for the iOS Version on #62

@hirbod
Copy link
Collaborator Author

hirbod commented Oct 6, 2015

btw, as far as I can see, there is no callback for android integrated. executeAppInvite does never do a sendPluginResult. Would you be so kind to implement this asap? I would love to provide a PR, and I already tried, but I really do not understand Java very well and I'm not experienced with the CDV API. Thank @jeduan

@possan
Copy link

possan commented Oct 18, 2015

+1 on this, commenting out those lines "work" but wont give you the callback..

@bau720123
Copy link

+1

@hirbod
Copy link
Collaborator Author

hirbod commented Nov 13, 2015

Should be fixed in master

@peterschmidler
Copy link

+1

@hirbod
Copy link
Collaborator Author

hirbod commented Dec 20, 2015

fixed with #94 - just wait for merge

@jeduan jeduan closed this as completed Dec 20, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants