简体   繁体   中英

android & facebook sdk - post a simple text to wall

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 ?

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.

add permissions in manifest of your application

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM