我正在尝试在我的应用程序中使用谷歌地图。我已经将谷歌服务地图和位置服务添加到我的应用程序的组件中了。我正在关注教程并查看有关它的含义的文档被实施,并用于要求谷歌播放服务,这些服务已被分成多个较小的组件。无论如何,当我运行应用程序时出现一个按钮,表示在我的应用程序中获得Google Play服务,当我点击它时会出现一个错误。 感谢您的帮助。在Xamarin中使用谷歌地图Android
未处理的异常:
Android.Content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details? id=com.google.android.gms&pcampaignid=gcore_8115000--- flg=0x80000 pkg=com.android.vending }
这里是我的代码:
//main.xaml
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
//Main Activity
public class MainActivity : Activity, IOnMapReadyCallback
{
private GoogleMap mMap;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
SetUpMap();
}
private void SetUpMap()
{
if (mMap == null)
{
FragmentManager.FindFragmentById<MapFragment>(Resource.Id.map).GetMapAsync(this);
}
}
public void OnMapReady(GoogleMap googleMap)
{
mMap = googleMap;
}
}
Android清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app1.app1" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="16" />
<application android:label="app1" android:icon="@drawable/Icon" android:theme="@style/CustomActionBarTheme">
<!-- Put your Google Maps V2 API Key here. -->
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/Google_Maps_Key" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<!-- Allow the application to access Google web-based services. -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- Google Maps for Android v2 will cache map tiles on external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Google Maps for Android v2 needs this permission so that it may check the connection state as it must download data -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Permission to receive remote notifications from Google Play Services -->
</manifest>
这正是我关注XD的教程,当他安装谷歌播放服务时,只是一个简单的问题,您是否使用谷歌播放服务地图? –
是的,我做了,它的工作;) – DST