I am trying to post an image to the Facebook using SDK v3.6 ShareDialog.
As a result I got com.facebook.FacebookException: Error retrieving image attachment.
I did just like Doc says:
private void ShareDialog(){
OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
//action.setProperty("game", "https://example.com/cooking-app/meal/Lamb-Vindaloo.html");
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
List<Bitmap> images = new ArrayList<Bitmap>();
images.add(bitmap);
FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(this, action, "cooking-app:cook", "game")
.setImageAttachmentsForAction(images, true)
.build();
uiHelper.trackPendingDialogCall(shareDialog.present());
}
And I know I need to add <provider android:authorities="com.facebook.app.NativeAppCallContentProvider{Facebook-app-id}"
android:name="com.facebook.NativeAppCallContentProvider" />
in AndroidManifest.xml, but when I did this, there is an error code, Multiple annotations found at this line:
- Tag <provider> attribute authorities has invalid character '{'.
- Exported content providers can provide access to potentially sensitive
data
How to add a provider correctly?
In your provider
definition, where it says {Facebook-app-id}
you have to fill in the app id provided to by Facebook.
Add the content provider to your manifest.
<provider
android:name="com.facebook.NativeAppCallContentProvider"
android:authorities="com.facebook.app.NativeAppCallContentProvider{Facebook-App-Id}"
android:exported="true" />
Make sure exported= true (as above)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With