Android Facebook API and ShareLinkContent -
for android app game have implemented button allows user share result of game.
i have integrated facebook sdk, classes known project. manifest contains following tags:
<meta-data android:name="com.facebook.sdk.applicationid" android:value="@string/app_id" /> <provider android:authorities="com.facebook.app.facebookcontentprovider16..." android:name="com.facebook.facebookcontentprovider" android:exported="true"/>
when run app can share result of game code below.
public void onshareresult(view view){ facebooksdk.sdkinitialize(getapplicationcontext()); callbackmanager = callbackmanager.factory.create(); final sharedialog sharedialog = new sharedialog(this); sharedialog.registercallback(callbackmanager, new facebookcallback<sharer.result>() { @override public void onsuccess(sharer.result result) { log.d(log_tag, "success"); } @override public void onerror(facebookexception error) { log.d(log_tag, "error"); } @override public void oncancel() { log.d(log_tag, "cancel"); } }); if (sharedialog.canshow(sharelinkcontent.class)) { sharelinkcontent linkcontent = new sharelinkcontent.builder() .setcontenttitle("game result highscore") .setcontentdescription("my new highscore " + sum.gettext() + "!!") .setcontenturl(uri.parse("https://play.google.com/store/apps/details?id=de.ginkoboy.flashcards")) //.setimageurl(uri.parse("android.resource://de.ginkoboy.flashcards/" + r.drawable.logo_flashcards_pro)) .setimageurl(uri.parse("http://bagpiper-andy.de/bilder/dudelsack%20app.png")) .build(); sharedialog.show(linkcontent); } }
however there things not understand.
- the shared link looks different see in dialog before post.
- images seem have been available via internet. i.e. not possible set image of resource project.
furthermore have trouble understanding facebook requiring.
this how facebook displays posting:
and how app seem post content
so question is: title , description gone???
best regards
oliver
so, have found out reason why title , description not visible in facebook.
first of @mustafasevgi solution refers sdk 3.5.x tried use sdk 4.0
coming solution...
i have found out have set content url app inside google play store. if set content url outside of google play store title , description not overwritten.