Android Facebook SDK - Share dialog does not respond to cancel callback -
i'm working facebook sdk 4.0 on android app , found problem:
-when share post, can see facebook interface , can post , cancel perfectly. registered callbacks, if press cancel button, oncancel callback not called, post not published, onsuccess callback called. however, if touch close button, works ok.
here code:
private void fbonshare(){ sharelinkcontent sharecontent = new sharelinkcontent.builder() .setcontenttitle("the simpson!") .setcontenturl(uri.parse("http://www.foxplay.com/ar/show/6980-los-simpson?gclid=cpa-7n-y7mucfymshwodnlyakq")) .build(); this._btnshare = (sharebutton)findviewbyid(r.id.share_button); this._btnshare.setsharecontent( sharecontent ); _btnshare.registercallback( this._fbcallbackmanager, new facebookcallback<sharer.result>() { @override public void onsuccess(sharer.result result) { log.v("myapp", "share success!"); //showed if press share or cancel button } @override public void oncancel() { log.v("myapp", "share canceled"); //only showed when press close button } @override public void onerror(facebookexception e) { log.v("myapp","share error: " + e.tostring()); } }); }
the _fbcallbackmanager created in method initializes in oncreate method activity.
the "cancelar" button respond onsuccess callback inspite of not post share content. "close" button works ok.
according this not bug , should stay way.
the way know if user accepted publishing check postid on result.
you have postid if user didn't cancel , if user logged in app , has publish permissions. otherwise null.
yeah know, sucks.
Comments
Post a Comment