android parse sdk facebook login cannot get email -


im integrated parse , facebook sdk project , work , id , user name of facebook user issue cannot thing else email or gender or other information add permission them.

this permission :

private static final list<string> permissions = arrays.aslist("public_profile","email","user_friends","user_birthday","user_location","user_relationships"); 

button click code :

button mbtnfb=(button)findviewbyid(r.id.mbtnfb);      mbtnfb.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             parsefacebookutils.loginwithreadpermissionsinbackground(mainactivity.this,permissions , new logincallback() {                 @override                 public void done(parseuser user, parseexception err) {                     if (user == null) {                         log.d("myapp", "the user cancelled facebook login.");                     } else if (user.isnew()) {                         log.d("myapp", "user signed , logged in through facebook!");                         getuserdetailsfromfb();                     } else {                         log.d("myapp", "user logged in through facebook!");                         getuserdetailsfromparse();                     }                 }             });         }     }); 

get user details facebook:

public string name,email; parseuser parseuser=new parseuser();  private void getuserdetailsfromfb() {     graphrequest request = graphrequest.newmerequest(             accesstoken.getcurrentaccesstoken(),             new graphrequest.graphjsonobjectcallback() {                 @override                 public void oncompleted(                         jsonobject object,                         graphresponse response) {                      try {                         string id=object.getstring("id");                         string name=object.getstring("name");                         string email=object.getstring("email");                         string gender=object.getstring("gender");                         string birthday=object.getstring("birthday");                      } catch (jsonexception e) {                         e.printstacktrace();                      }                 }             });     bundle parameters = new bundle();     parameters.putstring("fields", "id,name,link,email");     request.setparameters(parameters);     request.executeasync();  } 

i id , name , other info give me exception suggestion ?

i had same issue, here's how solved it:

  1. go https://developers.facebook.com/
  2. click "tools & support" (at top menu)
  3. click "graph api explorer" (at left side menu called "tools")
  4. where says "application: graph api explorer" (at top right) change application working with.
  5. where says "get token" click "get user access token"
  6. tick "user_about_me"
  7. click on "extended permissions"
  8. tick "email"
  9. click "get access token"
  10. facebook may prompt confirm.

this should give application permission retrieve email address of facebook user.

hope helps.

regards, nathanial


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -