I have a working implementation of Googles PanoramaAPI in my Application. Unfortunately, the implementation stopped working on Android 11.
The implementation looks like the following:
Uri uri = Uri.fromFile(file);
Panorama.PanoramaApi.loadPanoramaInfoAndGrantAccess(mClient, uri).setResultCallback(
new ResultCallback<PanoramaResult>() {
@Override
public void onResult(PanoramaResult result) {
if (result.getStatus().isSuccess()) {
Intent viewerIntent = result.getViewerIntent();
Log.i(TAG, "found viewerIntent: " + viewerIntent);
if (viewerIntent != null) {
startActivity(viewerIntent);
finish();
}
} else {
Log.e(TAG, "error: " + result);
}
}
});
Following Situation:
- When I make a panorama image on my smartphone and load it into the given implementation, it works. The image get's loaded from
/storage/emulated/0/DCIM/Camera/*.jpg
and the panorama view is shown without a problem. - When I Upload the same image on a server and download it through the app, the image get's stored on
/storage/emulated/0/Android/data/<applicationId>/files/*.jpg
. Unfortunately, the panorama view is not able to load the image and theviewerIntent
is allwaysnull
.
For me, it looks like a permission problem on Android 11, but I don't know how to fix it. I don't want to download the image into a more public area of the phone. Does anyone has an idea how to fix it?
I suspect it is related to the introduction of Scoped Storage in Android 11, but I'm not sure.
I've managed to put together an alternative to the Panorama API using the VR Kit, which I've documented in my blog post with some code snippets.
The TLDR is this:
ImageView
with aVrPanoramaView
VrPanoramaView
's API to hide some options (optional)VrPanoramaView
and use it to toggle between gyroscopic and touch modesVrPanoramaView