当前位置: 首页>>代码示例>>Java>>正文


Java Session.openActiveSession方法代码示例

本文整理汇总了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);

    }
}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:19,代码来源:EditProfileFragment.java

示例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);
	}

}
 
开发者ID:netanelkl,项目名称:guitar_guy,代码行数:26,代码来源:FacebookProfileConnector.java

示例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;
}
 
开发者ID:3bytessolutions,项目名称:CallService-Facebook-sample,代码行数:18,代码来源:UserHome.java

示例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;
}
 
开发者ID:3bytessolutions,项目名称:CallService-Facebook-sample,代码行数:22,代码来源:PickFriendsActivity.java

示例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;
}
 
开发者ID:3bytessolutions,项目名称:CallService-Facebook-sample,代码行数:17,代码来源:FbLoginActivity.java

示例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);
    }
}
 
开发者ID:alessandrogurgel,项目名称:pedefacil,代码行数:12,代码来源:FbLoginDelegate.java

示例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);
	}
}
 
开发者ID:ohmp,项目名称:UniversalSocialLoginAndroid,代码行数:10,代码来源:FacebookLoginActivity.java

示例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);
    }
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:14,代码来源:FacebookAuth.java

示例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();

       	}
       	 
       }
       
});
   }
 
开发者ID:Paulocajr,项目名称:IPRJapp,代码行数:75,代码来源:Tutorial_1.java


注:本文中的com.facebook.Session.openActiveSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。