![](/img/trans.png)
[英]Opening browser url when clicking a marker in my Google Maps Activity from my own Android App
[英]How to open photosphere via URL from Google Maps in own android app
我是一名菜鳥android開發人員。 我正在開發的應用程序可以直接從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
}
}
});
}
為了清楚起見 ,我使用略有不同的方法來接收圖像-R.drawable.imagename而不是圖像的直接路徑,但是事實並非如此。 正如我所說,我想通過Uri.parse從Google Maps提供到Photosphere的直接鏈接,但取得了成功。 我不確定是否錯過了這里的重要內容,還是無法在自己的應用中使用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");
在此先感謝您提供解決方案或答案!
URI只能接受文件,內容或資源。 這在Panorama API文檔中有所說明
uri-要加載有關信息的全景圖的URI。 可能是file:,content:或android_resource:方案。
嘗試將圖片本身的URL解析為URI。
Uri uri = Uri.parse("imageURL");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.