I'm trying to open the Google StreetView on Panorama mode from my Android app.
I really wanna open the Google StreetView and not Google Maps, because I wanna use it with a Virtual Reality application that uses a VR Glass, that uses stereo view and panorama mode. The panorama mode that I wanna is like that: https://youtu.be/3mQKGEnWxIw
The following code opens the StreetView app:
PackageManager pm = this.getPackageManager();
Intent intent = pm.getLaunchIntentForPackage("com.google.android.street");
startActivity(intent);
But it opens on the default screen.
EDIT 1:
I discovered how to open the panorama Activity of the Street View. First I listed the available Activities from the application:
void listAppActivities(String packagename) {
PackageManager pManager = getPackageManager();
Intent startIntent = new Intent();
startIntent.setPackage(packagename);
List<ResolveInfo> activities = pManager.queryIntentActivities(startIntent, 0);
for (ResolveInfo ri : activities) {
System.out.println("getAppActivities::nome::" + ri.activityInfo.name);
}
}
Then I used the Activity com.google.vr.app.StreetViewApp.StreetViewApp. I can launch StreetView Panorama Activity directly using this code:
void openStreetView() {
String packagename = "com.google.android.street";
PackageManager pm = this.getPackageManager();
Intent intent = pm.getLaunchIntentForPackage(packagename);
intent.setComponent(new ComponentName(packagename, "com.google.vr.app.StreetViewApp.StreetViewApp"));
startActivity(intent);
}
But I still don't know how to pass the locations parameters to StreetView. How can I do that?
I have tested using URI:
Uri gmmIntentUri;
//gmmIntentUri = Uri.parse("geo:"+lat+","+lng); // Test1
gmmIntentUri = Uri.parse("google.streetview:cbll="+lat+","+lng); // Test2
//gmmIntentUri = Uri.parse("http://maps.google.com/maps?ll="+lat+","+lng); // Test3
intent.setData(gmmIntentUri);
And using Intent.putExtra:
intent.putExtra("cbll", lat+","+lng);
intent.putExtra("args", "cbll="+lat+","+lng);
intent.putExtra("lat", new Double(lat));
intent.putExtra("long", new Double(lng));
intent.putExtra("lng", new Double(lng));
But no success. Does anyone know how to pass the location parameters to StreetView App on Panorama mode?
EDIT 2:
I discovered that if I use a Street View Highlighted link, or a featured location, it is possible to open Street View on Panorama mode, passing the URI Intent. I tested the following links:
https://www.google.com/streetview/#christmas-island/ethel-beach-2 https://www.google.com/streetview/#russian-landmarks/terskol-1 https://www.google.com/streetview/#day-of-the-dead-in-mexico/ofrenda-dia-de-muertos-zocalo
More can be found here: https://www.google.com/streetview/
But still don't know how to pass a generic location.