android - Sharing photo using facebook sdk 4.2.0 -
sharedialog sharedialog = new sharedialog(this); sharedialog.registercallback(callbackmanager, new facebookcallback<sharer.result>() { @override public void onsuccess(sharer.result result) { toast.maketext(sharepage.this, "ok", toast.length_short).show(); } @override public void oncancel() { } @override public void onerror(facebookexception error) { toast.maketext(sharepage.this, error.getmessage(), toast.length_long).show(); } }); sharephoto photo = new sharephoto.builder().setbitmap(bm).setcaption(description).build(); sharephotocontent content = new sharephotocontent.builder().addphoto(photo).build(); sharedialog.show(content); the below code run. if have facebook app in mobile, it's share photo successful. if delete facebook app, callbackmanager return error "unable show provided content via web or installed version of facebook app. dialogs supported starting api 14."
you can show dialog if have native facebook app installed in device. try same code in device in facebook app installed work. if want make custom dialog need to
-build custom interface posts graph api endpoint /me/feed -implement facebook login in app -request publish_actions permission when people log app here's code posting link facebook own interface:
shareapi.share(content, null); let me know if need assistance. mark answer accepted if helps.
Comments
Post a Comment