Google街景应用(不是Google地图)的url方案

我正在使用带有街景应用程序的Google Cardboard。 我希望能够创建一个链接,将用户直接发送到街景应用程序以查看特定位置。

在街景应用程序中,我可以创建一个位置的链接,如果它是应用程序中的特色位置,它生成的链接可以完美地工作,看起来像这样: http : //www.google.com/maps/streetview/#我们-亮点/法纳尔大厅,波士顿

如果它不是特色位置,则它生成的url会有所不同,并在Google地图中打开,而不是在街景应用中打开,如下所示: https : //www.google.com/maps/@/data=!3m4! 1E1!3平方米!1s7lx0Oz8OSTwIweRXw7eNiA!2E0

是否可以创建在街景视图应用程序中打开的URL,该URL不是特色位置。 如果是这样,过程/格式是什么?

您可以通过将mapmode参数设置为streetview ,使用comgooglemaps URL Scheme以街景模式启动Google Maps for iOS应用程序。

目标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上的详细信息。