android - publish story on facebook via my app publishes to "only me" using Facebook sdk 3.0 -


while sharing app via facebook, works fine on post says "only me". want post should seen friends. below code snippet using:

 private static final list<string> permissions = arrays.aslist("publish_actions"); 

in on create method:

 com.facebook.settings.addloggingbehavior(loggingbehavior.include_access_tokens);       com.facebook.session session = com.facebook.session.getactivesession();         if (session == null) {             if (savedinstancestate != null) {                 session = com.facebook.session.restoresession(this, null, statuscallback, savedinstancestate);             }             if (session == null) {                 session = new com.facebook.session(this);             }             com.facebook.session.setactivesession(session);             if (session.getstate().equals(sessionstate.created_token_loaded)) {                 session.openforread(new com.facebook.session.openrequest(this).setcallback(statuscallback));                  session.openforpublish(new session.openrequest(this)                 .setcallback(statuscallback)                 .setloginbehavior(sessionloginbehavior.suppress_sso)                 .setpermissions(arrays.aslist("publish_actions")));               } 

i using foolowing code publishing story

private void uploadstoryusingfacebook() {  //  toast.maketext(homescreenactivity.this, "now can post story !!!",2000).show();       // check publish permissions         session session = session.getactivesession();     list<string> permissions = session.getpermissions();     if (!issubsetof(permissions, permissions)) {         pendingpublishreauthorization = true;         session.newpermissionsrequest newpermissionsrequest = new session                 .newpermissionsrequest(this, permissions);     session.requestnewpublishpermissions(newpermissionsrequest);         return;     }       bundle params = new bundle();         params.putstring("name", "");         params.putstring("link", "some link");         params.putstring("picture", "some picture");            feeddialogbuilder builder = new feeddialogbuilder(homescreenactivity.this, session.getactivesession(), params);          builder.setoncompletelistener(new oncompletelistener() {              @override             public void oncomplete(bundle values, facebookexception error) {                   if (error != null) {                  }                  if (error == null) {                      // when story posted, echo success                     // , post id.                      final string postid = values.getstring("post_id");                      if (postid != null) {                         toast.maketext(homescreenactivity.this,"posted story, id: "+postid,toast.length_short).show();                     } else {                         // user clicked cancel button                         toast.maketext(homescreenactivity.this, "publish cancelled",toast.length_short).show();                     }                 } else if (error instanceof facebookoperationcanceledexception) {                     // user clicked "x" button                     toast.maketext(homescreenactivity.this.getapplicationcontext(), "publish cancelled", toast.length_short).show();                 } else {                     // generic, ex: network error                     toast.maketext(homescreenactivity.this.getapplicationcontext(), "error posting story",toast.length_short).show();                 }               }         });          builder.build().show();   }  private boolean issubsetof(collection<string> subset, collection<string> superset) { (string string : subset) {     if (!superset.contains(string)) {         return false;     } } return true; 

}

can please guide me on solving issue?

try ->

  1. remove app fb account (follow link)
  2. now clear data on device.
  3. try publish again app, time ask permissions, along can see there dropdown @ bottom post visibility, change public.

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -