在Xamarin中使用Google Play服务定位功能

时间:2017-11-23 11:30:45

标签: xamarin.android google-play-services

我按照"位置客户"部分提到的步骤进行了操作。在https://developer.xamarin.com/guides/android/platform_features/maps_and_location/location/

在示例中,它在activity类中实现了var table = $("#mainTable").DataTable()接口。

这个界面来自哪里?我无法在我的代码中解决它们。我应该添加什么nuget包以及我应该导入什么?

1 个答案:

答案 0 :(得分:0)

  

这个界面来自哪里?我无法在我的代码中解决它们。我应该添加什么nuget包以及我应该导入什么?

您需要下载Xamarin.GooglePlayServices.Base包:

enter image description here

使用这些api时需要Check for Google Play Services

public bool IsPlayServicesAvailable()
{
    int resultCode = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this);
    if (resultCode != ConnectionResult.Success)
    {
        if (GoogleApiAvailability.Instance.IsUserResolvableError(resultCode))
            msgText.Text = GoogleApiAvailability.Instance.GetErrorString(resultCode);
        else
        {
            msgText.Text = "Sorry, this device is not supported";
            Finish();
        }
        return false;
    }
    else
    {
        msgText.Text = "Google Play Services is available.";
        return true;
    }
}