Google街景应用的网址方案(不是Google地图) [英] URL scheme for the Google Street View App (Not Google Maps)
问题描述
我正在将Google Cardboard与Street View应用程序配合使用.我希望能够创建一个链接,将用户直接发送到街景应用中以查看特定位置.
I'm using Google Cardboard with the Street View App. I want to be able to create a link that sends users directly into the Street View App to view a specific location.
在Street View应用程序中,我可以从某个位置创建链接,如果它是应用程序中的重要位置,则它生成的链接可以完美地工作,并且看起来像这样: http://www.google.com/maps/streetview/#us-highlights/法尼尔·霍尔·波士顿
Within the Street View App I can create a link from a location, if it's a featured location within the app, the link it generates works perfectly and looks something like this: http://www.google.com/maps/streetview/#us-highlights/faneuil-hall-boston
如果它不是精选位置,则它生成的URL是不同的,并且会在google地图(而不是街景应用)中打开,看起来像这样: https://www.google.com/maps/@/data=! 3m4!1e1!3m2!1s7lx0Oz8OSTwIweRXw7eNiA!2e0
If it's not a featured location, the URL it generates is different and opens in google maps, rather than the Street View app, looking something like this: https://www.google.com/maps/@/data=!3m4!1e1!3m2!1s7lx0Oz8OSTwIweRXw7eNiA!2e0
是否可以创建一个在街景视图"应用中打开的URL,而该URL不是重要位置.如果是这样,处理/格式是什么?
推荐答案
通过将 mapmode 参数设置为街景.
目标c
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"comgooglemaps://?center=46.414382,10.013988&mapmode=streetview"]]];
}
快捷键4
if UIApplication.shared.canOpenURL(URL(string: "comgooglemaps://")!) {
guard let url = URL(string: "comgooglemaps://?center=46.414382,10.013988&mapmode=streetview") else {
return //be safe
}
if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(url)
}
}
&有关更多详细信息,请参见 Google Streetview .
& more details here on Google Streetview.
这篇关于Google街景应用的网址方案(不是Google地图)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!