How to share bitmap with text and url on facebook?

193 Views Asked by At

I tried different techniques but some one sharing only image on facebook and some sharing only text or textwith url using SharePhoto but no one sharing local image like bitmap,description and url at a time.May be I am doing wrong.I am stuck from one day if any one know about it then please give me some thing in details Thanks.

 // App code
     GraphRequest request = GraphRequest.newMeRequest(
                                loginResult.getAccessToken(),
                                new GraphRequest.GraphJSONObjectCallback() {
                                    @Override
                                    public void onCompleted(final JSONObject object, GraphResponse response) {
                                        Log.v("LoginActivity", response.toString());
                                        try {

                                            if (isurl) {
                                                ShareDialog shareDialog = new ShareDialog(mActivity);
                                                if (ShareDialog.canShow(ShareLinkContent.class)) {
                                                    ShareLinkContent linkContent = new ShareLinkContent.Builder()
                                                            .setContentUrl(Uri.parse("https://play.google.com/store?hl=en"))
                                                            .setContentDescription(message).setContentUrl(imgBitmapUri)
                                                            .build();
                                                    shareDialog.show(linkContent);
                                                }

                                            } else {
                                                SharePhoto.Builder sharePhotoBuilder = new SharePhoto.Builder();
                                                if (bitmap == null) {

                                                    sharePhotoBuilder.setBitmap(bitmap);
                                                } else {
                                                    sharePhotoBuilder.setImageUrl(Uri.parse(imgBitmapPath));
                                                }
                                                sharePhotoBuilder.setUserGenerated(false);
                                                final SharePhoto gesturePhoto = sharePhotoBuilder.build();
                                                ShareOpenGraphObject shareOpenGraphObject = new ShareOpenGraphObject.Builder()
                                                        .putString("og:type", "favorite.share")
                                                        .putString("og:description", message)
                                                        .putPhotoArrayList("og:image", new ArrayList<SharePhoto>() {{
                                                    add(gesturePhoto);
                                                        }}).build();
                                                ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
                                                        .setActionType("favorite.share")
                                                        .putObject("favorite:share", shareOpenGraphObject)
                                                        .build();
                                                ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
                                                        .setPreviewPropertyName("favorite:share").setPreviewPropertyName("image")
                                                        .setAction(action)
                                                        .build();
                                                ShareDialog.show(mActivity, content);
`enter code here`                                     }


                                            }

                                        } catch (Exception e) {
                                            e.printStackTrace();
                                        }
                                    }
                                });
                        Bundle parameters = new Bundle();
                        parameters.putString("fields", "id,name,first_name, last_name, email,link");
                        request.setParameters(parameters);
                        request.executeAsync();
0

There are 0 best solutions below