I want to share an image from my Android app using facebook SDK 4.0. I got it to work with ShareDialog, but when the user doesn't have FB app installed, according to developers.facebook, SDK should use Web Share dialog instead:
In past versions of the SDK for Android, your app had to check for a native, installed Facebook app before it could open the Share Dialog. If the person didn't have the app installed, you had to provide your own code to call a fallback dialog.
Now the SDK automatically checks for the native Facebook app. If it isn't installed the Web Share dialog launches:
But nothing happens when I delete FB app and try to share.
Here is my code:
ShareDialog shareDialog = new ShareDialog(this);
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
bmOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap image = BitmapFactory.decodeFile(imagePath, bmOptions);
SharePhoto photo = new SharePhoto.Builder().setBitmap(image).build();
SharePhotoContent content = new SharePhotoContent.Builder().addPhoto(photo).build();
shareDialog.show(content, ShareDialog.Mode.AUTOMATIC);
EDIT
Is there a way to share a photo on facebook without facebook app installed?
Please read SDK documents carefully. You cant share photo with sharedialog without Facebook App installed.
Refference : https://developers.facebook.com/docs/sharing/android
Photos
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