简体   繁体   English

Android和Facebook SDK-在墙上张贴简单的文字

[英]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. 我想做的是在Android Studio中使用Facebook SDK将简单的文本发布到墙上。 I want to post the text without the need of the Facebook app by the user. 我想发布文本而无需用户使用Facebook应用程序。 Is that possible? 那可能吗?

I've read https://developers.facebook.com/docs/android/share 我已阅读https://developers.facebook.com/docs/android/share

And I have 2 problems. 我有两个问题。

1) How can I set the text of my share? 1)如何设置共享文字?

   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.. 我看不到任何setText方法..或类似的东西..

Also can I do this without the facebook app installed on my phone? 还可以在手机上未安装Facebook应用程序的情况下执行此操作吗?

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 ? 我不想强迫我的用户安装Facebook。我该怎么办?

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) 您尚未授予访问Internet的权限(Manifest.xml)
  3. You have not used a correct hashkey for the app 您尚未为该应用程序使用正确的哈希键
  4. You did not provide a correct App Id 您没有提供正确的应用ID
  5. You have not installed Facebook in your device 您尚未在设备中安装Facebook

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. 编辑:您可以使用setName(String)设置标题,并使用setDescription(String)设置描述。 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"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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