【发布时间】:2019-02-11 20:51:02
【问题描述】:
我有一个问题是用谷歌地图打开地图:
我的设备 iPhone 已设置 App Google Maps,但我的应用在按下按钮时会链接到地图应用以打开地图。设备打开 Safari,不要打开 Google 地图。
我试试这个方法:Xamarin Forms - Maps - Is possible to call Google Maps from a button?
但在行代码:
var canOpenNative = UIApplication.SharedApplication.CanOpenUrl(NSUrl.FromString("comgooglemaps-x-callback://"));
我不能使用库:`using Foundation;
(构建应用程序将无法使用库。)
我尝试这种方式:Xamarin.Forms - 'Foundation' could not be found
但是在构建应用程序时,我无法使用库 Foundation 构建。
那么,还有其他方法,How to check Device iPhone setups App Google Maps in Xamarin.Forms?
谢谢!
【问题讨论】:
-
您可以通过 Forms 的依赖服务调用原生代码:docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/…
-
是否已将 Google 地图设置为安装在设备上或设置为默认地图应用程序?
-
@Adriani6 我想检查设备 (iPhone) 是否已设置 Google 地图。如果设备没有应用谷歌地图,设备将打开地图到 Safari 或其他应用地图。
标签: c# .net xamarin xamarin.forms