void GetUserPeople() { plusService = new ServicePlus() { RetryEnabled = true, Authorizer = SignIn.SharedInstance.Authentication }; // The following example uses the visible (PlusConstants.PlusCollectionVisible) collection to obtain a list of people // who the signed-in user has added to one or more circles, which is limited to the circles the // user made visible to the requesting app. This list does not include names of circles. var query = QueryPlus.QueryForPeopleListWithUserId("me", PlusConstants.PlusCollectionVisible); plusService.ExecuteQuery(query, (ticket, obj, error) => { // obj contains the query results, we must cast it to PlusPeopleFeed in order to get its information var peopleFeed = obj as PlusPeopleFeed; if (error != null) { InvokeOnMainThread(() => new UIAlertView("Error", error.Description, null, "Ok", null).Show()); } else { var root = new RootElement("People List") { new Section() }; foreach (var person in peopleFeed.Items) { root[0].Add(new StringElement(person.DisplayName)); } var dvc = new DialogViewController(root, true); InvokeOnMainThread(() => NavigationController.PushViewController(dvc, true)); } }); }
void GetUserInfo() { plusService = new ServicePlus() { RetryEnabled = true, Authorizer = SignIn.SharedInstance.Authentication }; // Create a QueryPlus object to get the details of the user with the given user ID. // The special value "me" indicates the currently signed in user, but you could use // any other valid user ID. Returns a PlusPerson. var query = QueryPlus.QueryForPeopleGetWithUserId("me"); plusService.ExecuteQuery(query, (ticket, obj, error) => { // obj contains the query results, we must cast it to PlusPerson in order to get its information var person = obj as PlusPerson; if (error != null) { InvokeOnMainThread(() => new UIAlertView("Error", error.Description, null, "Ok", null).Show()); } else { InvokeOnMainThread(() => { var section = Root[0]; section.Add(new StyledStringElement("Display Name", person.DisplayName, UITableViewCellStyle.Subtitle)); section.Add(new StyledMultilineElement("About Me", person.AboutMe, UITableViewCellStyle.Subtitle)); section.Add(new StyledStringElement("Birthday", person.Birthday, UITableViewCellStyle.Subtitle)); ReloadData(); }); } }); }
public void Finished(OAuth2Authentication auth, NSError error) { if (error != null) { //InvokeOnMainThread(() => new UIAlertView("Error", "Could not sign in.\nError: " + error.LocalizedDescription, null, "Ok", null).Show()); InvokeOnMainThread(() => new UIAlertView("Login Failed", "The social network login failed for your account", null, "Ok", null).Show()); HideLoadingView(); CrashReporter.Report(new Exception(error.LocalizedDescription)); return; } ShowLoadingView("Getting some user data..."); UserTrackingReporter.TrackUser(Constant.CATEGORY_LOGIN, "Google login successful"); AppSettings.LoginType = (int)LoginType.Google; AppSettings.UserToken = GetMd5Hash(md5Hash, SignIn.SharedInstance.UserEmail); AppSettings.UserEmail = SignIn.SharedInstance.UserEmail; AppSettings.UserType = ""; QueryPlus query = QueryPlus.QueryForPeopleGetWithUserId(SignIn.SharedInstance.UserId); SignIn.SharedInstance.PlusService.ExecuteQuery(query, GooglePlusPersonQueryCompleted); }