android - Retrieving Facebook friends working only on my device -


i developing app retrieves current user facebook friends. code working on device when run on other devices, not displaying results.

could please let me know going wrong.

my code follows :

public class facebook extends activity implements searchview.onquerytextlistener, searchview.oncloselistener{          arraylist<param> facebook_names = new arraylist<param>();         param name = null;         names_adapter adapter;         listview names_list;         searchview searchview;         int check_search =1;         arraylist<param>new_names;         private uilifecyclehelper uihelper;         private static final int reauth_activity_code = 100;            @suppresslint("newapi")         @override         protected void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);              setcontentview(r.layout.activity_face_book);              actionbar bar = getactionbar();             bar.setdisplayoptions(actionbar.display_show_custom);             bar.setcustomview(r.layout.custom_titlebar);             bar.setbackgrounddrawable(getresources().getdrawable(r.drawable.header));             //bar.settitle("main menu");             bar.setdisplayshowhomeenabled(true);               bar.sethomebuttonenabled(true);              uihelper = new uilifecyclehelper(this, callback);             uihelper.oncreate(savedinstancestate);              textview mytitletext = (textview) findviewbyid(r.id.mytext);             if ( mytitletext != null ) {                 mytitletext.settext("facebook");             }              log.d("comp", "test");                names_list = (listview) findviewbyid(r.id.listview1);                imagebutton reload = (imagebutton) findviewbyid(r.id.reload);              reload.setonclicklistener(new view.onclicklistener() {                  @override                 public void onclick(view v) {                     // todo auto-generated method stub                     intent restart  = new intent(facebook.this, facebook.class);                     startactivity(restart);                     finish();                 }             });            }                @override               public void onactivityresult(int requestcode, int resultcode, intent data) {                   super.onactivityresult(requestcode, resultcode, data);                   if (requestcode == reauth_activity_code) {                       uihelper.onactivityresult(requestcode, resultcode, data);                   }               }           @override         public boolean oncreateoptionsmenu(menu menu) {             // inflate menu; adds items action bar if present.             getmenuinflater().inflate(r.menu.face_book, menu);             searchmanager searchmanager = (searchmanager) getsystemservice(context.search_service);             searchview = (searchview) findviewbyid(r.id.searchview1);             searchview.setsearchableinfo(searchmanager.getsearchableinfo(getcomponentname()));             searchview.seticonifiedbydefault(false); // not iconify widget; expand default             return true;         }          @override         public boolean onquerytextsubmit(string arg0) {             // todo auto-generated method stub             return false;         }          @override         public boolean onquerytextchange(string query) {             // todo auto-generated method stub             if(!query.isempty())             {                  check_search = 0;                 new_names = new arraylist<param>();                 for(int i=0;i<facebook_names.size();i++)                 {                     if(facebook_names.get(i).getname().tolowercase().startswith(query))                     {                         param new_param = new param(facebook_names.get(i).geturl(),facebook_names.get(i).getname(),facebook_names.get(i).getpic());                         new_names.add(new_param);                         adapter.notifydatasetchanged();                       }                 }                   names_adapter adapter = new names_adapter(facebook.this,r.layout.facebook_names_list,new_names);                         names_list.setadapter(adapter);                         adapter.notifydatasetchanged();             }             else             {                 check_search=1;                  adapter = new names_adapter(facebook.this,r.layout.facebook_names_list,facebook_names);                     names_list.setadapter(adapter);             }              return false;         }          @override         public boolean onclose() {             // todo auto-generated method stub             names_list.setadapter(adapter);             return false;         }          @override         public boolean onoptionsitemselected(menuitem item) {             // todo auto-generated method stub              int itemid = item.getitemid();             switch (itemid) {             case android.r.id.home:                  facebook.this.finish();                 break;             }              return super.onoptionsitemselected(item);         }          private void makerequest(session session)         {             string fqlquery = "select uid,name,pic,profile_url user uid in " +                         "(select uid2 friend uid1 = me()) order first_name";                 bundle params = new bundle();                 params.putstring("q", fqlquery);                 session = session.getactivesession();                  request request = new request(session,                         "/fql",                                                  params,                                                  httpmethod.get,                                          new request.callback(){                            public void oncompleted(response response) {                         log.i("tag", "result: " + response.tostring());                          try{                             graphobject graphobject = response.getgraphobject();                             jsonobject jsonobject = graphobject.getinnerjsonobject();                             log.d("data", jsonobject.tostring(0));                              jsonarray array = jsonobject.getjsonarray("data");                             for(int i=0;i<array.length();i++){                                   jsonobject friend = array.getjsonobject(i);                               name = new param(friend.optstring("profile_url"),friend.optstring("name"),friend.optstring("pic"));                                 facebook_names.add(name);                              //   log.d("uid",friend.getstring("uid"));                               //  log.d("name", friend.getstring("name"));                                 //log.d("pic_square",friend.getstring("pic_square"));                                      adapter = new names_adapter(facebook.this,r.layout.facebook_names_list,facebook_names);                                     names_list.setadapter(adapter);                                   searchview.setonquerytextlistener(facebook.this);                                 searchview.setoncloselistener(facebook.this);                               names_list.setonitemclicklistener(new onitemclicklistener() {                                  @override                                 public void onitemclick(adapterview<?> arg0, view arg1, int arg2,                                         long arg3) {                                     // todo auto-generated method stub                                      intent intent = new intent(facebook.this,web_activity.class);                                     if(check_search==0)                                     {                                     intent.putextra("web",new_names.get(arg2).geturl());                                     intent.putextra("name",new_names.get(arg2).getname());                                     }                                     else                                     {                                         intent.putextra("web",facebook_names.get(arg2).geturl());                                            intent.putextra("name",facebook_names.get(arg2).getname());                                     }                                     startactivity(intent);                                 }                             });                              }                         }catch(jsonexception e){                             e.printstacktrace();                         }                       }                                   });                  request.executebatchasync(request);          }          private void onsessionstatechange(final session session, sessionstate state, exception exception) {             if (session != null && session.isopened()) {                 // user's data.                 makerequest(session);             }         }            public void onresume() {             super.onresume();             session session = session.getactivesession();             if (session != null &&                    (session.isopened() || session.isclosed()) ) {                 onsessionstatechange(session, session.getstate(), null);             }              uihelper.onresume();         }            private session.statuscallback callback = new session.statuscallback() {                 @override                 public void call(final session session, final sessionstate state, final exception exception) {                     onsessionstatechange(session, state, exception);                 }             };           @override         public void onsaveinstancestate(bundle bundle) {             super.onsaveinstancestate(bundle);             uihelper.onsaveinstancestate(bundle);         }          @override         public void onpause() {             super.onpause();             uihelper.onpause();         }          @override         public void ondestroy() {             super.ondestroy();             uihelper.ondestroy();         }     } 

i tried using restfb access user facebook friends.

accesstoken accesstoken =  new defaultfacebookclient().obtainappaccesstoken(appid,app secret;      facebookclient facebookclient = new defaultfacebookclient(accesstoken.getaccesstoken());  user user = facebookclient.fetchobject("me", user.class); 

when this, gives me error stating valid access token must used retrieve user values.

go facebook developer site, , under 'status , review' app, make public. can remove public later after 'temporary' testing complete.

or

another way print out key hashes each device testing app on, , add these key hashes settings>android in fb developer app.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -