當前位置: 首頁>>代碼示例>>Java>>正文


Java PlusClient.getCurrentPerson方法代碼示例

本文整理匯總了Java中com.google.android.gms.plus.PlusClient.getCurrentPerson方法的典型用法代碼示例。如果您正苦於以下問題:Java PlusClient.getCurrentPerson方法的具體用法?Java PlusClient.getCurrentPerson怎麽用?Java PlusClient.getCurrentPerson使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.plus.PlusClient的用法示例。


在下文中一共展示了PlusClient.getCurrentPerson方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onSignedIn

import com.google.android.gms.plus.PlusClient; //導入方法依賴的package包/類
@Override
public void onSignedIn(PlusClient plusClient) {
    mSignInStatus.setText(getString(R.string.signed_in_status));

    // We can now obtain the signed-in user's profile information.
    Person currentPerson = plusClient.getCurrentPerson();
    if (currentPerson != null) {
        String greeting = getString(R.string.greeting_status, currentPerson.getDisplayName());
        mSignInStatus.setText(greeting);
        // Add the user name in the Preferences
        AppPrefs.setUserAccountName(SignInActivity.this, currentPerson.getDisplayName());
        Intent reservationsIntent = new Intent(SignInActivity.this, NavDrawerMainActivity.class);
        startActivity(reservationsIntent);
        finish();
    } else {
        resetAccountState();
    }
}
 
開發者ID:someshk,項目名稱:samsung-chord-hackathon,代碼行數:19,代碼來源:SignInActivity.java

示例2: onSignedIn

import com.google.android.gms.plus.PlusClient; //導入方法依賴的package包/類
/**
 * Invoked when the {@link PlusClientFragment} delegate has successfully
 * authenticated the user.
 * 
 * @param plusClient
 *            The connected PlusClient which gives us access to the Google+
 *            APIs.
 */
@Override
public void onSignedIn(PlusClient plusClient) {
	if (plusClient.isConnected()) {
		mPlusPerson = plusClient.getCurrentPerson();

		// Retrieve the account name of the user which allows us to retrieve
		// the OAuth access
		// token that we securely pass over to the PhotoHunt service to
		// identify and
		// authenticate our user there.
		final String name = plusClient.getAccountName();

		// Asynchronously authenticate with the PhotoHunt service and
		// retrieve the associated
		// PhotoHunt profile for the user.
		mAuthTask = new AsyncTask<Object, Void, User>() {
			@Override
			protected User doInBackground(Object... o) {
				return AuthUtil.authenticate(BaseActivity.this, name);
			}

			@Override
			protected void onPostExecute(User result) {
				if (result != null) {
					setAuthenticatedProfile(result);
					executePendingActions();
					update();
				} else {
					setAuthenticatedProfile(null);
					mPlus.signOut();
				}
			}
		};

		mAuthTask.execute();
	}
}
 
開發者ID:vicfryzel,項目名稱:gplus-photohunt-client-android,代碼行數:46,代碼來源:BaseActivity.java


注:本文中的com.google.android.gms.plus.PlusClient.getCurrentPerson方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。