简体   繁体   English

如何通过自己的Android应用中的Google Maps通过URL打开Photosphere

[英]How to open photosphere via URL from Google Maps in own android app

I'm a rookie android developer. 我是一名菜鸟android开发人员。 I'm working on app which opens panoramas (photosphere 360 images) directly from google maps not from images stored on device like on example here . 我正在开发的应用程序可以直接从google地图打开全景图(photosphere 360​​图像),而不是从示例中的设备上存储的图像中打开全景图。

@Override
public void onConnected(Bundle connectionHint) {
Uri uri = Uri.parse("file://" + Environment.getExternalStorageDirectory() +"/DCIM/Camera/PANO_20131209_130755.jpg");

Panorama.PanoramaApi.loadPanoramaInfo(gacClient, uri).setResultCallback(
        new ResultCallback<PanoramaResult>() {
    @Override
    public void onResult(PanoramaResult result) {
        Intent i;
        if (result.getStatus().isSuccess() && (i = result.getViewerIntent()) != null) {
            startActivity(i);
        } else {
            // Handle unsuccessful result
        }
    }
});
}

Just to be clear I use slightly different approach for receiving image - R.drawable.imagename instead of direct path to image, but this is not a case. 为了清楚起见 ,我使用略有不同的方法来接收图像-R.drawable.imagename而不是图像的直接路径,但是事实并非如此。 As I said i wanted to provide a direct link to photosphere from Google Maps via Uri.parse but whitout success. 正如我所说,我想通过Uri.parse从Google Maps提供到Photosphere的直接链接,但取得了成功。 I'm not sure if I missed something crucial here or there is no way to use available photosphere on Google Maps in own app. 我不确定是否错过了这里的重要内容,还是无法在自己的应用中使用Google Maps上可用的Photosphere。

Uri uri = Uri.parse("https://www.google.pl/maps/@37.826,-122.421833,3a,75y,275.52h,91.47t/data=!3m8!1e1!3m6!1s-JpUn9Jc8nE4%2FU9WHk3F6ofI%2FAAAAAAAAJmE%2FlpWfb4Rc5x0!2e4!3e11!6s%2F%2Flh4.googleusercontent.com%2F-JpUn9Jc8nE4%2FU9WHk3F6ofI%2FAAAAAAAAJmE%2FlpWfb4Rc5x0%2Fw203-h101-n-k-no%2F!7i10500!8i5250"); 

Thanks in advance for answers or ideas how to deal with it! 在此先感谢您提供解决方案或答案!

URI can only take in files, content, or resource. URI只能接受文件,内容或资源。 This is stated in the Panorama API documentation 这在Panorama API文档中有所说明

uri - the URI of the panorama to load info about. uri-要加载有关信息的全景图的URI。 May be a file:, content:, or android_resource: scheme. 可能是file:,content:或android_resource:方案。

Try parsing the URL of the image itself into the URI. 尝试将图片本身的URL解析为URI。

Uri uri = Uri.parse("imageURL");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM