名称“ AccountPicker”在当前上下文中不存在-Xamarin.Android

帕维尔

我正在尝试学习如何AccountPicker在自己的计算机中使用功能XamarinAndroid应用程序,无法确定必须安装的包含此功能的库。

Android有关此文档的信息,请参见以下网址https : //developers.google.com/android/reference/com/google/android/gms/common/AccountPicker

该应用程序正在28 APILevel下开发

寿司宿醉

AccountPicker班是在Android.Gms.Common命名空间中,并且通过NuGet包可用Xamarin.GooglePlayServices.Basement

注意:通常Basement是作为其他Xamarin.GooglePlayServices.*软件包之一的依赖项安装的(Maps / Places / Tasks / ...),但您可以安装它,它会添加所有Xamarin.Android.Support。*相关性...

回复:https//www.nuget.org/packages/Xamarin.GooglePlayServices.Basement

例; 请求帐号:

~~~
var intent = Android.Gms.Common.AccountPicker.NewChooseAccountIntent(null, null, new String[] { "com.google" }, false, null, null, null, null);
StartActivityForResult(intent, 99);
~~~

接收帐户:

protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
{
    if (requestCode == 99 && resultCode == Result.Ok)
    {
        var accountName = data.GetStringExtra(AccountManager.KeyAccountName);
        Log.Debug("SO", accountName);
    }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Xamarin.Android:CS0103名称“ SetSupportActionBar”在当前上下文中不存在

Xamarin。名称'authorEntry在当前上下文中不存在

名称“ HapticFeedback”在当前上下文中不存在-Xamarin.Forms

Xamarin:名称“ x”在当前上下文中不存在

名称“ InitializeComponent”在当前上下文中不存在(C#,Xamarin)

“名称“ DisplayAlert”在当前上下文中不存在。” Xamarin C#

AppCenter Build:错误CS0103:名称“ Android”在当前上下文中不存在

名称“”在当前上下文中不存在

名称“ ...”在当前上下文中不存在

名称“控制台”在xamarin表单应用程序的当前上下文中不存在

如何解决 Stripe xamarin 绑定错误?(CS0103 当前上下文中不存在名称“开始”)

名称“ [插入名称]”在当前上下文中不存在

ASP.NET MVC在当前上下文中不存在名称“文件”

该名称在当前上下文中不存在?

名称“服务器”在当前上下文中不存在

UNITY-名称“ AssetDatabase”在当前上下文中不存在

Windows Phone 8.1上的flipview错误“名称”在当前上下文中不存在”

Emgu:名称CV_RBG2GRAY在当前上下文中不存在

名称“模型”在当前上下文中不存在

名称“ ModelState”在当前上下文中不存在

名称“ zipfile”在当前上下文中不存在

名称“ SqlServerValueGenerationStrategy”在当前上下文中不存在

名称“配置”在当前上下文中不存在

ASP.NET Core-名称'JsonRequestBehavior'在当前上下文中不存在

名称“ nameof”在当前上下文中不存在

名称“ crystalReportViewer”在当前上下文中不存在

名称Request在当前上下文中不存在

名称“ ARSubsystemManager”在当前上下文中不存在

Blazor名称“ Invoke”在当前上下文中不存在