Reputation: 870
Ok guys I don't know what I am doing wrong and I am losing my mind over this issue.I just started using Facebook Android SDK and I have no Idea what I am doing wrong.
I am developing a app which needs to share picture on Facebook.First I tried sharing status.It worked just fine.
Then I tried sharing photos according to the information on the documentations.Nothing happened.
This is my manifest.
<activity android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<provider android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider1501607393******"
android:exported="true"/>
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"/>
The App id is correct.And I have set up a ContentProvider in my AndroidManifest.xml.
And this is my Java.
Bitmap image2 = BitmapFactory.decodeResource(getResources(), R.drawable.android);
SharePhoto photo = new SharePhoto.Builder().setBitmap(image2).build();
SharePhotoContent content = new SharePhotoContent.Builder().addPhoto(photo).build();
ShareDialog dialog = new ShareDialog(MainActivity.this);
dialog.show(content);
Please help.
Upvotes: 2
Views: 1979
Reputation: 870
After much pondering I finally solved this problem.For image share to work properly one should keep two things in mind.
1.Set up ContentProvider in your AndroidManifest.xml.
<provider android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider1501607393******"
android:exported="true"/>
where 1501607393****** is your app code.
2.Install the official Facebook app in the device before testing yourapp.
Upvotes: 2
Reputation: 1193
Dear Birat Bade Shrestha, For Photos,news feeds etc. you have to make special submission to facebook. Bydefault email, public_profile is permissible for app.But for any other use, you have to make a submission and if the submission granted by FB, you can access.
https://developers.facebook.com/docs/facebook-login/review/how-to-submit
Upvotes: 0
Reputation: 71
try this code maybe work for you.
public boolean sharePhoto(Bitmap image, String description) {
if (ShareDialog.canShow(SharePhotoContent.class)) {
SharePhoto photo = new SharePhoto.Builder().setBitmap(image)
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo).build();
shareDialog.show(content);
return true;
}
return false;
}
Upvotes: 1