Getting user facebook likes and attributes in Android(Facebook SDK 3.18) -


this login function:-

public void logintofacebook() {         mprefs = getpreferences(mode_private);         access_token = mprefs.getstring("access_token", null);         long expires = mprefs.getlong("access_expires", 0);          if (access_token != null) {             facebook.setaccesstoken(access_token);         }          if (expires != 0) {             facebook.setaccessexpires(expires);         }          if (!facebook.issessionvalid()) {             facebook.authorize(this,new string[] { "email", "publish_stream" },                     new dialoglistener() {                          @override                         public void oncancel() {                             // function handle cancel event                         }                          @override                         public void oncomplete(bundle values) {                             // function handle complete event                             // edit preferences , update facebook acess_token                             sharedpreferences.editor editor = mprefs.edit();                             editor.putstring("access_token",                                     facebook.getaccesstoken());                             editor.putlong("access_expires",                                     facebook.getaccessexpires());                             editor.commit();                         }                          @override                         public void onerror(dialogerror error) {                             // function handle error                          }                          @override                         public void onfacebookerror(facebookerror fberror) {                             // function handle facebook errors                          }                      });         }     } 

this function facebook likes , attributes:

public void getprofileinformation() {         masyncrunner.request("me", new requestlistener() {             @override             public void oncomplete(string response, object state) {                 log.d("profile", response);                 string json = response;                 try {                     jsonobject profile = new jsonobject(json);                     id=profile.getstring("id");                     // getting name of user                     name = profile.getstring("name");                     // getting email of user                     email = profile.getstring("email");                     //about=profile.getstring(about);                     bio=profile.getstring(bio);                     birthday=profile.getstring(birthday);                     gender=profile.getstring(gender);                     link=profile.getstring(link);                     locale=profile.getstring(locale);                     political=profile.getstring(political);                     quotes=profile.getstring(quotes);                     relationship_status=profile.getstring(relationship_status);                     relegion=profile.getstring(relegion);                     website=profile.getstring(website);                      log.d("name",name);                        runonuithread(new runnable() {                          @override                         public void run() {                             toast.maketext(getapplicationcontext(), "name: " + name + "\nemail: " + email, toast.length_long).show();                         }                      });                  } catch (jsonexception e) {                     e.printstacktrace();                 }             }              @override             public void onioexception(ioexception e, object state) {             }              @override             public void onfilenotfoundexception(filenotfoundexception e,                     object state) {             }              @override             public void onmalformedurlexception(malformedurlexception e,                     object state) {             }              @override             public void onfacebookerror(facebookerror e, object state) {             }         });         //getting facebook         session session = session.getactivesession();              new request(                      session,                      "/{id}/likes",                 null,                 httpmethod.get,                 new request.callback() {                     public void oncompleted(response response) {                         log.d("facebook likes", response.tostring());                     }                 }         ).executeasync();         /*session session = session.getactivesession();         request.callback callback = new request.callback() {              @override             public void oncompleted(response response) {                 // response should have likes                 toast.maketext(getapplicationcontext(), response.tostring(), toast.length_long).show();                 log.d("facebook likes", response.tostring());             }         };         request request = new request(session, "me/likes", null, httpmethod.get, callback);         requestasynctask task = new requestasynctask(request);         task.execute();*/ 

error:- d/request﹕ warning: sessionless request needs token missing either application id or client token.

i getting other attributes 28959-29486/com.example.sensetest d/profile﹕ {"id":"************","email":"***********","first_name":"***","gender":"male","last_name":"****","link":"****","locale":"en_us","middle_name":"singh","name":"rituraj singh rathore","timezone":5.5,"updated_time":"2015-03-22t11:01:08+0000","verified":true}

the problem not able facebook likes of user has logged in. have tried how user likes facebook android sdk 3.0. didn't got desired result. me regarding this, doing wrong. should make right?


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -