I have an equirectangular image like this:
I have the image in my AssetsFolder, therefor I pass this uri to the Panorama.PanoramaApi.loadPanoramaInfo method:
Uri uri = Uri.parse("file:///android_asset/panorama/equi_1.jpg");
Somehow, if I check the result.getViewerIntent, I get null as return value.
My gut feeling says this could have to do with the fact that this image is not created with the google camera app, and therefor missing some meta tags, but I'm not sure.
The complete code of my PanoramaActivity:
public class PanoramaActivity extends Activity implements GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener {
public static final String PANORAMA_URI = "panorama_uri";
private GoogleApiClient gacClient;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
gacClient = new GoogleApiClient.Builder(this, this, this)
.addApi(Panorama.API)
.build();
}
@Override
public void onStart() {
super.onStart();
gacClient.connect();
}
@Override
public void onConnected(Bundle connectionHint) {
Intent intent = getIntent();
if (intent != null) {
String fileUri = intent.getStringExtra(PANORAMA_URI);
if (fileUri != null && !fileUri.isEmpty()) {
Uri uri = Uri.parse("file:///android_asset/panorama" + fileUri);
Panorama.PanoramaApi.loadPanoramaInfo(gacClient, uri).setResultCallback(
new ResultCallback<PanoramaApi.PanoramaResult>() {
@Override
public void onResult(PanoramaApi.PanoramaResult result) {
Intent i;
if (result.getStatus().isSuccess() && (i = result.getViewerIntent()) != null) {
startActivity(i);
} else {
// Handle unsuccessful result
}
}
});
} else {
finish();
}
} else {
finish();
}
}
@Override
public void onConnectionSuspended(int cause) {
// Handle connection being suspended
}
@Override
public void onConnectionFailed(ConnectionResult status) {
// Handle connection failure.
}
@Override
public void onStop() {
super.onStop();
gacClient.disconnect();
}
}