0

What I want to do is posting a simple text to wall with the facebook sdk in android studio. I want to post the text without the need of the Facebook app by the user. Is that possible?

I've read https://developers.facebook.com/docs/android/share

And I have 2 problems.

1) How can I set the text of my share?

   FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
            .setLink("https://developers.facebook.com/android")
            .build();
    uiHelper.trackPendingDialogCall(shareDialog.present());

I can't see any setText method..or something like that..

Also can I do this without the facebook app installed on my phone?

I get the error

Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider

I don't want to force my users to have facebook installed.. what should I do ?

Boldijar Paul
  • 4,925
  • 7
  • 39
  • 83

2 Answers2

1

Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider

This can happen due to the following reasons:

  1. You are not connected to internet
  2. You have not given permission for internet access ( Manifest.xml)
  3. You have not used a correct hashkey for the app
  4. You did not provide a correct App Id
  5. You have not installed Facebook in your device

Check if you have added the permissions:

<uses-permission android:name="android.permission.INTERNET"/>

<uses-permission android:name="android.permission.SET_DEBUG_APP"/>

EDIT: You can use setName(String) to set the title and setDescription(String) to set the description. take a look at this documentation link.

Community
  • 1
  • 1
Sagar Pilkhwal
  • 5,825
  • 2
  • 24
  • 76
  • I already know why i have the problem, is 5.. read my question again – Boldijar Paul Sep 29 '14 at 12:06
  • by _"How can I set the text of my share"_ you mean you want to have a custom title for your `FacebookDialog` ? – Sagar Pilkhwal Sep 29 '14 at 12:11
  • FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this) .setApplicationName("Excuse Me").setCaption("LALALA").setDescription("asda").setName("neim") .build(); uiHelper.trackPendingDialogCall(shareDialog.present()); this will crash my app if I don't have facebook installed and if i have it will open a empty post dialog on facebook, without any text, just 'what's in your mind' ... – Boldijar Paul Sep 29 '14 at 12:18
  • error about what? is not working without facebook sdk with this method. this is the problem.. Error: com.facebook.FacebookException: Error publishing message – Boldijar Paul Sep 29 '14 at 12:24
  • _"I want to post the text without the need of the Facebook app by the user"_ i dont think its possible – Sagar Pilkhwal Sep 29 '14 at 12:31
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/62114/discussion-between-boldijar-paul-and-sagar-pilkhwal). – Boldijar Paul Sep 29 '14 at 12:33
1

add permissions in manifest of your application

<uses-permission android:name="android.permission.INTERNET"/>

<uses-permission android:name="android.permission.SET_DEBUG_APP"/>
Patrizio
  • 135
  • 4
  • I have thoose already.. i've asked 2 things, how can I share a text with facebook sdk without the app installed, and how to share just a text, my code will share a link – Boldijar Paul Sep 29 '14 at 12:07
  • shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); shareIntent.setType("text/plain"); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Free education for all! http://linkd.in/xU8mCc"); startActivity(shareIntent); – Patrizio Sep 29 '14 at 12:25
  • @Partizio i don't want to share a link man, i want to share a text, is it that hard to understand ? – Boldijar Paul Sep 29 '14 at 12:27
  • @Paul ve u got any solution.i need to share just text. – Srishti Roy Dec 29 '15 at 06:33
  • @SrishtiRoy I think I got, but this was too long ago and I don't remember how I did. – Boldijar Paul Dec 29 '15 at 19:25