本文整理匯總了Java中com.google.android.gms.plus.Plus類的典型用法代碼示例。如果您正苦於以下問題:Java Plus類的具體用法?Java Plus怎麽用?Java Plus使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Plus類屬於com.google.android.gms.plus包,在下文中一共展示了Plus類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: logout
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
/**
* Unauthenticate from Firebase and from providers where necessary.
*/
private void logout() {
if (this.mAuthData != null) {
/* logout of Firebase */
mFirebaseRef.unauth();
/* Logout of any of the Frameworks. This step is optional, but ensures the user is not logged into
* Facebook/Google+ after logging out of Firebase. */
if (this.mAuthData.getProvider().equals("facebook")) {
/* Logout from Facebook */
LoginManager.getInstance().logOut();
} else if (this.mAuthData.getProvider().equals("google")) {
/* Logout from Google+ */
if (mGoogleApiClient.isConnected()) {
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
mGoogleApiClient.disconnect();
}
}
/* Update authenticated user and show login buttons */
setAuthenticatedUser(null);
}
}
示例2: onCreate
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.build();
mGoogleLoginClicked = true;
if (!mGoogleApiClient.isConnecting()) {
if (mGoogleConnectionResult != null) {
resolveSignInError();
} else if (mGoogleApiClient.isConnected()) {
getGoogleOAuthTokenAndLogin();
} else {
/* connect API now */
Log.d(TAG, "Trying to connect to Google API");
mGoogleApiClient.connect();
}
}
}
示例3: getProfileInformation
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
/**
* Fetching user's information name, email, profile pic
* */
private void getProfileInformation() {
ringProgressDialog.dismiss();
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
Person currentPerson = Plus.PeopleApi
.getCurrentPerson(mGoogleApiClient);
String personName = currentPerson.getDisplayName();
String personPhotoUrl = currentPerson.getImage().getUrl();
String personGooglePlusProfile = currentPerson.getUrl();
String birth = currentPerson.getBirthday();
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
// by default the profile url gives 50x50 px image only
// we can replace the value with whatever dimension we want by
// replacing sz=X
// personPhotoUrl = personPhotoUrl.substring(0,
// personPhotoUrl.length() - 2)
// + PROFILE_PIC_SIZE;
//new LoadProfileImage().execute(personPhotoUrl);
} else {
Toast.makeText(getApplicationContext(),
"Person information is null", Toast.LENGTH_LONG).show();
}
}
示例4: init
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
public void init() {
final Client thisReference = this;
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
debugLog("Client.init : initializing Google Play Game Services...");
googleApiClient = new GoogleApiClient.Builder(getActivity())
.addConnectionCallbacks(thisReference)
.addOnConnectionFailedListener(thisReference)
.addApi(Games.API).addScope(Games.SCOPE_GAMES)
.addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN)
.addApi(Drive.API).addScope(Drive.SCOPE_APPFOLDER)
.build();
}
});
}
示例5: onCreate
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_gmail_layout);
session = new Session(this);
googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build();
googleApiClient = new GoogleApiClient.Builder(this).enableAutoManage(this, this)
.addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions)
.addApi(Plus.API).build();
btnLogin = (SignInButton) findViewById(R.id.signin_button);
btnLogin.setSize(SignInButton.SIZE_ICON_ONLY);
btnLogin.setScopes(googleSignInOptions.getScopeArray());
btnLogin.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Intent signin = Auth.GoogleSignInApi.getSignInIntent(googleApiClient);
startActivityForResult(signin, REQUEST_CODE_LOGIN);
}
});
if(session.loggedin()){
startActivity(new Intent(LoginGmailActivity.this, MainActivity.class));
finish();
}
}
開發者ID:ProposalProyekIT2,項目名稱:SISTEM-INFORMASI-GEOGRAFIS-LOKASI-RESTORAN-DI-KOTA-BANDUNG-SUB-MODUL-ANDROID-BASE-APPLICATION-,代碼行數:27,代碼來源:LoginGmailActivity.java
示例6: GoogleApiClientDelegate
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
public GoogleApiClientDelegate(Activity activity, UserHelper userHelper, Bundle savedInstanceState) {
this.mUserHelper = userHelper;
mGoogleApiClient =
new GoogleApiClient.Builder(activity)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_LOGIN)
// .addScope(Plus.SCOPE_PLUS_PROFILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
mResolvingError = savedInstanceState != null
&& savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);
}
示例7: onConnected
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
@Override
public void onConnected(Bundle bundle) {
Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
User user = new User();
user.setProvider(PROVIDER_NAME);
user.setProviderDisplayName("Google+");
user.setUserId(currentPerson.getId());
user.setUserName(currentPerson.getId());
user.setFirstName(currentPerson.getName().getGivenName());
user.setLastName(currentPerson.getName().getFamilyName());
user.setDisplayName(currentPerson.getDisplayName());
user.setMail(Plus.AccountApi.getAccountName(mGoogleApiClient));
this.mUserHelper.setCurrentUser(user);
if (this.mUserSessionCallback != null) {
this.mUserSessionCallback.onLogin();
}
}
示例8: revokeAccess
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
public void revokeAccess() {
Log.d(MCXApplication.LOG_TAG, "gplus: revoke access");
if (mGoogleApiClient.isConnected()) {
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
Plus.AccountApi
.revokeAccessAndDisconnect(mGoogleApiClient)
.setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
if (status.isSuccess()) {
Log.d(MCXApplication.LOG_TAG,"gplus: revoke access succeeded");
mGoogleApiClient.disconnect();
mUserHelper.setCurrentUser(null);
mUserSessionCallback.onLogout();
mGoogleApiClient.connect();
}
else {
Log.e(MCXApplication.LOG_TAG,"gplus: failure revoking access");
}
}
});
}
}
示例9: revokeAccess
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
public void revokeAccess() {
Log.d(MCXApplication.LOG_TAG,"gplus: revoke access");
if (mGoogleApiClient.isConnected()) {
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
Plus.AccountApi
.revokeAccessAndDisconnect(mGoogleApiClient)
.setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
if (status.isSuccess()) {
Log.d(MCXApplication.LOG_TAG,"gplus: revoke access succeeded");
updateConnectButtonState();
onPlusClientRevokeAccess();
mUserHelper.setCurrentUser(null);
mUserSessionCallback.onLogout();
}
else {
Log.e(MCXApplication.LOG_TAG,"gplus: failure revoking access");
}
}
});
}
}
示例10: onConnected
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
@Override
public void onConnected(Bundle bundle) {
updateConnectButtonState();
setProgressBarVisible(false);
Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
User user = new User();
user.setProvider(PROVIDER_NAME);
user.setProviderDisplayName("Google+");
user.setUserId(currentPerson.getId());
user.setUserName(currentPerson.getId());
user.setFirstName(currentPerson.getName().getGivenName());
user.setLastName(currentPerson.getName().getFamilyName());
user.setDisplayName(currentPerson.getDisplayName());
this.mUserHelper.setCurrentUser(user);
if (this.mUserSessionCallback != null) {
this.mUserSessionCallback.onLogin();
}
onPlusClientSignIn();
}
示例11: logout
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
private void logout(AuthData authData) {
this.mAuthData = authData;
if (this.mAuthData != null) {
/* logout of Firebase */
ref.unauth();
/* Logout of any of the Frameworks. This step is optional, but ensures the user is not logged into
* Facebook/Google+ after logging out of Firebase. */
if (this.mAuthData.getProvider().equals("facebook")) {
/* Logout from Facebook */
LoginManager.getInstance().logOut();
} else if (this.mAuthData.getProvider().equals("google")) {
/* Logout from Google+ */
if (mGoogleApiClient.isConnected()) {
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
mGoogleApiClient.disconnect();
}
}
/* Update authenticated user and show login buttons */
// setAuthenticatedUser(null);
}
}
示例12: onCreate
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "onCreate()");
// Create the Google Api Client with access to Plus and Games
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN)
.addApi(Games.API).addScope(Games.SCOPE_GAMES)
.build();
// Set up click listeners
setContentView(R.layout.activity_main);
findViewById(R.id.button_open_inbox).setOnClickListener(this);
findViewById(R.id.button_send_gift).setOnClickListener(this);
findViewById(R.id.button_send_request).setOnClickListener(this);
findViewById(R.id.button_sign_in).setOnClickListener(this);
findViewById(R.id.button_sign_out).setOnClickListener(this);
mGiftIcon = BitmapFactory.decodeResource(getResources(),
R.drawable.ic_send_gift);
}
示例13: showSignOutBar
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
private void showSignOutBar() {
findViewById(R.id.sign_in_bar).setVisibility(View.GONE);
findViewById(R.id.sign_out_bar).setVisibility(View.VISIBLE);
Player player = Games.Players.getCurrentPlayer(mGoogleApiClient);
String url = player.getIconImageUrl();
TextView name = (TextView)findViewById(R.id.playerName);
name.setText(player.getDisplayName());
if (url != null) {
ImageView vw = (ImageView) findViewById(R.id.avatar);
// load the image in the background.
new DownloadImageTask(vw).execute(url);
}
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
TextView emailView = (TextView)findViewById((R.id.playerEmail));
emailView.setText(email);
}
示例14: onCreate
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create the Google Api Client with access to Plus and Games
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN)
.addApi(Games.API).addScope(Games.SCOPE_GAMES)
.build();
// set up a click listener for everything we care about
for (int id : CLICKABLES) {
findViewById(id).setOnClickListener(this);
}
}
示例15: onCreate
import com.google.android.gms.plus.Plus; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create the Google API Client with access to Plus and Games
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN)
.addApi(Games.API).addScope(Games.SCOPE_GAMES)
.build();
// Setup signin and signout buttons
findViewById(R.id.sign_out_button).setOnClickListener(this);
findViewById(R.id.sign_in_button).setOnClickListener(this);
mDataView = ((TextView) findViewById(R.id.data_view));
mTurnTextView = ((TextView) findViewById(R.id.turn_counter_view));
}