【问题标题】:getLastSignedInAccount / LastSignedInAccountgetLastSignedInAccount / LastSignedInAccount
【发布时间】:2018-11-29 10:45:45
【问题描述】:

Google 标志 documentation 提到通过调用检查现有用户:

GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);

使用 Xamarin 时的等价物是什么,它位于哪里?或者它不存在,在这种情况下,当我的用户已经使用 Google 登录时,我该如何处理。项目的Xamarin demo 不包含等效代码。

【问题讨论】:

    标签: xamarin.android google-signin google-oauth


    【解决方案1】:

    使用大写 G

    GoogleSignInAccount account = GoogleSignIn.GetLastSignedInAccount(this);
    

    【讨论】:

      【解决方案2】:

      请确保您拥有对 Xamarin.GooglePlayServices.Auth 包的 Nuget 引用。 还要添加对:

      的引用
      using Android.Gms.Auth.Api.SignIn;
      

      【讨论】: