Android: OpenGraph Stories sharing in Facebook with SDK 4.0 -
i trying implement achievements sharing facebook when player unlocks badge. have made object using object browser in facebook developer console. made action-types , object-types , made custom story. stuck trying share story facebook. documentation given facebook inadequate. sample code given facebook uses v3.x
sample code given facebook given below. couldnt find documentation.
code object
bundle params = new bundle(); request request = new request( session.getactivesession(), "me/objects/enguru_app:badge", params, httpmethod.post ); response response = request.executeandwait(); // handle response
code action
bundle params = new bundle(); params.putstring("badge", "http://samples.ogp.me/1114467558579559"); request request = new request( session.getactivesession(), "me/enguru_app:unlocked", params, httpmethod.post ); response response = request.executeandwait(); // handle response
at last figured out own issue.
here solution:
shareopengraphobject object = new shareopengraphobject.builder() .putstring("og:type", "enguru_app:badge") .putstring("og:title", "unlocked newbie badge") .putstring("og:url","xxxx") .putstring("og:image","xxx") .putstring("game:points", "10") .putstring("fb:app_id", "xxx") .putstring("og:description", "we rocking. come , play us").build(); // create action shareopengraphaction action = new shareopengraphaction.builder() .setactiontype("enguru_app:unlocked") .putobject("badge", object).build(); // create content shareopengraphcontent content = new shareopengraphcontent.builder() .setpreviewpropertyname("badge").setaction(action) .build(); sharedialog.show(profile.this, content);
i hope going through same issue.
Comments
Post a Comment