I am currently working on the Google Plus login feature in my application.
I created a GoogleApiClient builder as shown below
Plus.PlusOptions options = new Plus.PlusOptions.Builder() .addActivityTypes("http://schemas.google.com/AddActivity") .build(); myGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this)
And the onConnected method
@Override public void onConnected(Bundle arg0) { // TODO Auto-generated method stub plusUtilities.ShowToast("Login successful"); updateGPbutton(); // hide progress DiaLog plusUtilities.DissmissPD(); // it has deprecated // plusUtilities.ShowToast("Login to Google+ with " + // mPlusClient.getAccountName().toString()); // upgraded class plusUtilities.ShowToast("Login to Google+ with " + Plus.AccountApi.getAccountName(myGoogleApiClient).toString()); // deprecated // mPlusClient.loadPeople(this, "me"); Plus.PeopleApi.load(myGoogleApiClient, "me"); // plusUtilities.ShowPD("Fetching user data... "); // upgraded and call fetch_user_details method here instead of calling // in onPersonLoad() override method Log.d("Googleplusclient", "" + Plus.PeopleApi.getCurrentPerson(myGoogleApiClient)); Plus.PeopleApi.loadVisible(myGoogleApiClient, null).setResultCallback(this); if (Plus.PeopleApi.getCurrentPerson(myGoogleApiClient) != null) { Person currentPerson = Plus.PeopleApi .getCurrentPerson(myGoogleApiClient); fetch_User_Details(currentPerson); } }
Below method returns null
Plus.PeopleApi.getCurrentPerson (myGoogleApiClient)
I followed the link for the solution. Then I followed this developer link . So far I am getting a null value.
How to resolve this?
source share