My app is having Share button to share story on users timeline. What I\'m doing is, user taps on Share button, if user session is not present app forces to Logi
remove all the publishStory() calling. in your callback do this:
public void call(Session session, SessionState state,
Exception exception) {
if(session != null && session.isOpened() && isShared){
publishStory();
}
}
in your UpdateDetails class declare isShared as boolean isShared = false;
and when user tap on share button make it true, like:
shareBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
isShared = true;
doPostStory();
}
});
in your publishStorys onComplete make isShared false. like:
public void onCompleted(Response response) {
isShared = false;
...................
...................
}
hope this will help.
Create Facebook Session Object
Then Just Apply This in onCreate Method.
Session.openActiveSession(this, true, new Session.StatusCallback() {
// callback when session changes state
@Override
public void call(Session session, SessionState state,
Exception exception) {
if (session.isOpened()) {
// make request to the /me API
Request.newMeRequest(session,
new Request.GraphUserCallback() {
// callback after Graph API response with user
// object
@Override
public void onCompleted(GraphUser user,
Response response) {
FacebookLoginActivity.this.progressDialog = ProgressDialog
.show(YourActivity.this,
"",
"",
true);
if (user != null) {
Intent passIntent = new Intent(YourActivity.this,Second.class)
startActivity(passIntent)
}
}
}).executeAsync();
}
}
});