Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to know that Facebook.share() has completed? #1

Open
godspeedelbow opened this issue Oct 10, 2014 · 3 comments
Open

Comments

@godspeedelbow
Copy link

Can I provide a callback or listen for an event, like with the login dialog?

Cheers!

@mokesmokes
Copy link
Owner

See the docs: https://developers.facebook.com/docs/reference/android/current/class/FacebookDialog/
Not totally straightforward:
We can use getNativeDialogDidComplete but that won't give us much data - only that an error did or did not occur.
getNativeDialogCompletionGesture will let you know if the result was post or cancel, but that will be called only if the user authorized the app. Note that share() can be called even without the user logging in to Facebook, so this is not general enough.
getNativeDialogPostId will give you the post ID, but only if the user gave you publish permissions.

In any case you can't know what is the content of the share, who the user chose to share it with (public, friends, custom friend list, etc), did he share the location, etc. So I suppose we can change share() to provide an optional callback which will be called under certain conditions... However the developer will need to be aware of all these conditions for the callback to be fired since in many cases none will be fired..... For simplicity's sake and also since the amount of info the app gets I didn't do this, but we could add this.....

@godspeedelbow
Copy link
Author

Thanks for the extensive reply @mokesmokes! The reason I request it, is because I need to know when the user is done (regardless whether the share was successful or not). I figured I can also listen to the resume event on the activity, but I then don't know if it should say 'thanks for sharing' :)

For our particular use case, users did authorize our app, so getNativeDialogCompletionGesture would actually be very valuable us. Perhaps we could allow the user to pass a callback as a second argument to the share function and call the callback with following arguments:

  • error (Boolean)
  • nativeDialogCompletionGesture (String, optional)
  • nativeDialogPostId(String, optional)

Last two arguments will be undefined when user authorized the app.

Since getNativeDialogDidComplete is always set, this would allow us to always fire the callback, am I right? I think we should only allow the developer to provide a callback if we can guarantee to call it.

The last time I did anything in Java was 10 years ago, so I don't feel comfortable doing the dirty work here.

Let me know what you think! Thanks for working on this module, it's really appreciated.

Cheers,

Eelke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants