本文整理汇总了Java中com.facebook.Session.openActiveSession方法的典型用法代码示例。如果您正苦于以下问题:Java Session.openActiveSession方法的具体用法?Java Session.openActiveSession怎么用?Java Session.openActiveSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.Session
的用法示例。
在下文中一共展示了Session.openActiveSession方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fetchProfileInfoFromFacebook
import com.facebook.Session; //导入方法依赖的package包/类
/**
* Fetch profile information from Facebook
*/
private void fetchProfileInfoFromFacebook() {
mWasProfileImageUploaded = false;
final Session session = Session.getActiveSession();
if (!session.isOpened() && !session.isClosed()) {
session.openForRead(new Session.OpenRequest(this)
.setPermissions(Arrays
.asList(AppConstants
.FBPERMISSIONS))
.setCallback(this));
} else {
Session.openActiveSession(getActivity(), this, true, this);
}
}
示例2: connect
import com.facebook.Session; //导入方法依赖的package包/类
@Override
public void connect(Activity activity)
{
Session session = Session.getActiveSession();
// TODO: I think we should validate the session here, but to what
// extent?
MadFacebookStatusCallback statusCallback =
new MadFacebookStatusCallback();
// Check if the session is already open.
if (!session.isOpened() && !session.isClosed())
{
OpenRequest openRequest = new OpenRequest(activity);
session.openForRead(openRequest
.setCallback(statusCallback));
}
else
{
Session.openActiveSession(activity, true,
statusCallback);
}
}
示例3: ensureOpenSession
import com.facebook.Session; //导入方法依赖的package包/类
private boolean ensureOpenSession() {
if (Session.getActiveSession() == null
|| !Session.getActiveSession().isOpened()) {
Session.openActiveSession(this, true, PERMISSIONS,
new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
onSessionStateChanged(session, state, exception);
}
});
return false;
}
// friendPickerFragment.loadData(false);
return true;
}
示例4: ensureOpenSession
import com.facebook.Session; //导入方法依赖的package包/类
private boolean ensureOpenSession() {
if (Session.getActiveSession() == null
|| !Session.getActiveSession().isOpened()) {
Session.openActiveSession(this, true, PERMISSIONS,
new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
onSessionStateChanged(session, state, exception);
}
});
return false;
}
if(friendPickerFragment == null) {
String test;
test= "0";
}
//friendPickerFragment.loadData(false);
return true;
}
示例5: ensureOpenSession
import com.facebook.Session; //导入方法依赖的package包/类
private boolean ensureOpenSession() {
if (Session.getActiveSession() == null
|| !Session.getActiveSession().isOpened()) {
Session.openActiveSession(this, true, PERMISSIONS,
new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
onSessionStateChanged(session, state, exception);
}
});
return false;
}
makeMeRequest();
return true;
}
示例6: onClickLogin
import com.facebook.Session; //导入方法依赖的package包/类
public void onClickLogin() {
Session session = Session.getActiveSession();
if (!session.isOpened() && !session.isClosed()) {
Session.OpenRequest openRequest = new Session.OpenRequest(mContext);
openRequest.setPermissions(this.mPermissions);
openRequest.setCallback(this);
session.openForRead(openRequest);
} else {
Session.openActiveSession(mContext, true, this);
}
}
示例7: onClickLogin
import com.facebook.Session; //导入方法依赖的package包/类
private void onClickLogin() {
Session session = Session.getActiveSession();
if (!session.isOpened() && !session.isClosed()) {
session.openForRead(new Session.OpenRequest(this).setPermissions(
Arrays.asList("email","user_birthday")).setCallback(this));
} else {
Session.openActiveSession(this, true, this);
}
}
示例8: login
import com.facebook.Session; //导入方法依赖的package包/类
@Override
public void login() {
Session session = Session.getActiveSession();
if ( activity == null )
return;
if (session != null && !session.isOpened() && !session.isClosed()) {
session.openForRead(new Session.OpenRequest(activity)
.setPermissions(Arrays.asList("public_profile", "email"))
.setCallback(statusCallback));
} else {
Session.openActiveSession(activity, true, Arrays.asList("public_profile", "email"), statusCallback);
}
}
示例9: onCreate
import com.facebook.Session; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null)
TutoRes = savedInstanceState.getInt("TutoRes");
facebook = new Facebook(APP_ID);
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
//loginFacebook();
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.tutorial_1);
//setLogin();
Session.openActiveSession(this, true, new Session.StatusCallback() {
@Override
public void call(final Session session, SessionState state, Exception exception) {
if (session.isOpened()) {
Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
//welcome = (TextView) findViewById(R.id.welcome);
Userid = user.getId();
User_name= user.getFirstName();
}
}
}).executeAsync();
}
}
});
final Button Button = (Button) findViewById(R.id.button1);
Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(Userid != null && User_name != null){
Intent intent = new Intent();
intent.setClass(Tutorial_1.this,Tutorial_2.class);
db.addUsuario(new Usuario(User_name,Userid));
startActivity(intent);
finish();
}
else {
Toast.makeText(getApplicationContext(), "Aguarde o carregamento dos dados do perfil do Facebook", Toast.LENGTH_SHORT).show();
}
}
});
}