我正在使用下面的代码在 Facebook 上分享照片。但是按钮被禁用了。我试过 this link 中的代码我能够让它发挥作用。这是我的代码:
Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.ic_information);
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(image)
.setCaption("Hello World!")
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.setContentUrl(Uri.parse("https://developers.facebook.com"))
.addPhoto(photo)
.build();
shareButton = (ShareButton) findViewById(R.id.buttonShare);
shareButton.setShareContent(content);
最佳答案
好吧,这已经晚了,但我花了很长时间才弄明白,所以我想我会在这里分享解决方案。来自 Facebook 开发者网站:
People can share photos from your app to Facebook with the Share Dialog or with a custom interface.
The photos must be less than 12MB in size
People need the native Facebook for Android app installed, version 7.0 or higher
所以底线是:您必须安装 Facebook Android 应用程序才能使用照片的共享按钮或共享对话框。安装该应用程序后,一旦您设置了内容,该按钮就会启用。
关于android - 在 Android 应用程序中共享照片时,Facebook "Share"按钮被禁用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38045476/