0

I am trying to load a photo sphere image into an activity and view it like one does in the Gallery. I cannot seem to find any examples or samples of this functionality anywhere on the web.

Documentation PanoramaClient

Thoughts, examples, code sets or suggestions on how this could be accomplished?

1 Answers1

0

The announcement posts for the Photo Sphere API details how you would load a PhotoSphere from a URI:

// This listener will be called with information about the given panorama.
OnPanoramaInfoLoadedListener infoLoadedListener =
  new OnPanoramaInfoLoadedListener() {
    @Override
    public void onPanoramaInfoLoaded(ConnectionResult result,
                                 Intent viewerIntent) {
        if (result.isSuccess()) {
            // If the intent is not null, the image can be shown as a
            // panorama.
            if (viewerIntent != null) {
                // Use the given intent to start the panorama viewer.
                startActivity(viewerIntent);
            }
        }

        // If viewerIntent is null, the image is not a viewable panorama.
    }
};

// Create client instance and connect to it.
PanoramaClient client = ...
...

// Once connected to the client, initiate the asynchronous check on whether
// the image is a viewable panorama.
client.loadPanoramaInfo(infoLoadedListener, panoramaUri);

Note that this opens the Photo Sphere in their viewer - there is no built in Photo Sphere viewer that you embed in your Activity.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • Is there a written sample of this implemented anywhere? – Morgan Culbertson Jul 07 '13 at 01:04
  • @AtomicLock - given that you've already seen the documentation and it's note saying "You should instantiate [the PanoramaClient] in your Activity's `onCreate(Bundle)` method and then call `connect()` in `onStart()` and `disconnect()` in `onStop()`, regardless of the state." what other code are you looking for? This is literally all there is. – ianhanniballake Jul 07 '13 at 01:13
  • So there is no way I could capture/hook-into user click locations on the image because it opens the Android viewer and not something embedded into the activity (locally)? – Morgan Culbertson Jul 07 '13 at 02:16
  • Or is it possible to do this using a webview and capture the users click location within the photo sphere with some JavaScript? Is this possible? – Morgan Culbertson Jul 07 '13 at 02:28
  • @AtomicLock - that's correct. There is no way to get an interactive photo sphere in your `Activity` via the Google provided APIs. You could certainly try to build your own based on the [Photo Sphere metadata specification](https://developers.google.com/photo-sphere/metadata/), but that would not be for the faint of heart. – ianhanniballake Jul 07 '13 at 03:15
  • Possibilities that it would work with an id added to their JavaScript web code? (All web based) https://developers.google.com/photo-sphere/web/ with something like this? http://www.emanueleferonato.com/2006/09/02/click-image-and-get-coordinates-with-javascript/ – Morgan Culbertson Jul 07 '13 at 03:32