4

I am trying to use facebook SDK to implement sharing in my android application, and have implemented exactly like the documentation says on the facebook page . I check for the session and the publish_actions permissions before i call the share dialog as below.

            if (FacebookDialog.canPresentShareDialog(getApplicationContext(),
                FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
            // Publish the post using the Share Dialog
            FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
                    .setName("Hello Facebook")
                    .setDescription("The 'Hello Facebook' sample application showcases simple Facebook integration")
                    .setLink("http://developers.facebook.com/android")
                    .build();
            }

The share dialogbox appears but it is blank without the content i added in .setLink() etc. Just to be sure I wasnt missing out any configurations, I tested the HelloFacebookSample from the facebook SDK samples and that has the same issue. When i click on "Post Status Update" I see an empty share box.

I am running this on a Nexus 4 phone with Android 4.4.2 and the facebook app version 9.0.0.26.28. Is there something I need to do on my setup to make it work. The strange thing is I do remember seeing the dialog box being populated earlier, so there must be something I have done to break it.

Any help will be appreciated, I have battered my head on this for over a week.

stervale
  • 51
  • 1
  • 4
  • does this help? http://stackoverflow.com/a/23659459/3518278 – usr30911 May 17 '14 at 06:17
  • I can't find either setName or setDescription on the page you linked to. And pre-filling is not allowed according to the Platform Policy so it may be that is the reason for them not doing anything – WizKid May 17 '14 at 06:20
  • @WizKid setName or setDescription were copied from the facebook example HelloFacebookSample, but even if I test with only .setLink it doesnt work. I did find out though that if I actually end up posting, those details show up on the post even though they didnt show up on the post dialog. Must be a facebook bug. – stervale May 19 '14 at 06:27
  • What version of the SDK are you using, and did you try another link (like a nytimes url)? – Ming Li May 20 '14 at 17:25
  • ever figure this out @stervale? I'm running into the same problem. – andy mcevoy Oct 21 '14 at 04:24
  • same problem too, any solution ? – emresancaktar Apr 05 '15 at 09:35

2 Answers2

1

I'm pretty sure it's a facebook bug, because the share gets posted fine to the facebook page, it's only that the share dialog appears to be blank while I am doing it. In fact the same app works fine in other phones, so something particular about my setup that triggers the bug.

I filed a facebook bug and hope it get fixed.

Thanks for the answers everyone.

stervale
  • 51
  • 1
  • 4
0

Example from my application:

Definition of uiHelper on the start of MainActivity:

private UiLifecycleHelper uiHelper;

And in the onCreate function:

uiHelper = new UiLifecycleHelper(this, null);
uiHelper.onCreate(savedInstanceState);

And in the corresponding section of my application a call to show the actual share dialog:

FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
    .setLink("Hello Facebook")
    .setName("The 'Hello Facebook' sample application showcases simple Facebook integration")
    .setCaption("http://developers.facebook.com/android")
    .setPicture("imageURL")
    .build();
    uiHelper.trackPendingDialogCall(shareDialog.present());

Just in case i would like to mention that you need to add your Debug Android hash or public keystore hash to the settings of your Application on Facebook control panel under Android tab(More info on key hash generation: Facebook Android Generate Key Hash).

I hope any of my suggestions helps, i was having alot of problems with Facebook SDK aswell.

And does your logcat gives any error or clue to why this is happening?

Community
  • 1
  • 1
Matjaz Trcek
  • 261
  • 3
  • 15