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
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?
在您的provider
定义中,它显示{Facebook-app-id}
您必须填写Facebook提供的应用ID。
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)
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.