android - Cant import Request, Session and response Facebook SDK 4.0. [Egregious Documentation] -


i using facebook sdk 4.0 , want post on users wall using opengraph api.

i have defined action as:

  • celebrating

the object

  • milestone

now when in facebook dev console click on code , switch android following snippet:

request request = new request(     session.getactivesession(),     "me/objects/friendsampleapp:milestone",     params,     httpmethod.post );  response response = request.executeandwait(); 

here cant options import response, request , session.

i option import com.facebook.login.loginclient.request; red squiggly line on hover says: the type com.facebook.login.loginclient not visible.

the point worth note here in same activity, login working fine not issue importing facebook library.

in changelog facebook mentions:

session removed - accesstoken, loginmanager , callbackmanager classes supercede , replace functionality in session class.

i wonder if facebook expects me dream of how interface api code when broken, releasing sdk's @ rate, not helping anyone.

i tried log bug report facebook seems facebook, broken too!

edit:

digging deeper have changed above code to:

bundle params = new bundle();                 graphrequest request = new graphrequest(accesstoken.getcurrentaccesstoken(),"me/objects/friendsampleapp:milestone",params, httpmethod.post);                 graphresponse response = request.executeandwait();                   bundle params1 = new bundle();                 params1.putstring("milestone", "http://samples.ogp.me/812890225461181");                  graphrequest request1 = new graphrequest(                         accesstoken.getcurrentaccesstoken(),"me/friendsampleapp:celebrating",params,httpmethod.post);                 graphresponse response1 = request.executeandwait(); 

but confused, next?

here final thing have come , apparently, work:

shareopengraphobject object = new shareopengraphobject.builder()                         .putstring("og:type", "friendsampleapp:milestone")                         .putstring("og:title", "a game of thrones")                         .putstring("og:description", "in frozen wastes north of winterfell, sinister , supernatural forces mustering.")                          .build();                   // create action                 shareopengraphaction action = new shareopengraphaction.builder()                         .setactiontype("friendsampleapp:celebrating")                         .putobject("milestone", object)                         .build();                   // create content                 shareopengraphcontent content = new shareopengraphcontent.builder()                         .setpreviewpropertyname("milestone")                         .setaction(action)                         .build();                     sharedialog.show(getactivity(), content);  

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -