android - Share Photo on Facebook using Facebook 4.0 without native app installed -
android - Share Photo on Facebook using Facebook 4.0 without native app installed -
i'm using facebook 4.0 share photos through app i'm unable share photos phone. can share image net providing it's url doesn't work image phone. code i'm using sharing below.
public void sharephoto(uri contenturi, string contenttitle, bitmap image, string contentdescription){ sharedialog facebookdialog = new sharedialog(getactivity()); sharelinkcontent.builder content = new sharelinkcontent.builder(); content.setcontenturl(contenturi); content.setcontenttitle(contenttitle); content.setimageurl(getimageuri(getactivity(), image)); content.setcontentdescription(contentdescription); sharelinkcontent sharecontent = content.build(); facebookdialog.show(sharecontent); } public uri getimageuri(context incontext, bitmap inimage) { bytearrayoutputstream bytes = new bytearrayoutputstream(); inimage.compress(bitmap.compressformat.jpeg, 100, bytes); string path = mediastore.images.media.insertimage(incontext.getcontentresolver(), inimage, "title", null); homecoming uri.parse(path); }
i know can share bitmap phone using next
public void shareimage(bitmap image){ sharedialog facebookdialog = new sharedialog(getactivity()); sharephoto photo = new sharephoto.builder().setbitmap(image).build(); sharephotocontent content = new sharephotocontent.builder().addphoto(photo).build(); facebookdialog.show(content); }
however code requires native facebook app installed on phone. there way share bitmap without having native app installed.
if native app not installed, other way share bitmap publish_actions
permission user, , post me/photos (you can utilize shareapi class actual post you, still need inquire permission user). unfortunately, web-based dialogs not back upwards uploading binary data.
android facebook image sharing
Comments
Post a Comment