【问题标题】:Google PanoramaAPI stopped working on Android 11Google PanoramaAPI 停止在 Android 11 上运行
【发布时间】:2020-10-05 15:24:08
【问题描述】:

我在我的应用程序中有一个 Googles PanoramaAPI 的工作实现。不幸的是,该实现在 Android 11 上停止运行。

实现如下所示:

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);
                }
            }
        });

以下情况:

  • 当我在智能手机上制作全景图像并将其加载到给定的实现中时,它可以工作。图片从/storage/emulated/0/DCIM/Camera/*.jpg 加载,全景视图显示没有问题。
  • 当我在服务器上上传相同的图像并通过应用程序下载时,图像会存储在/storage/emulated/0/Android/data/&lt;applicationId&gt;/files/*.jpg 上。不幸的是,全景视图无法加载图像,viewerIntent 始终为null

对我来说,这看起来像是 Android 11 上的权限问题,但我不知道如何解决。我不想将图像下载到手机的更公共区域。有谁知道如何解决它?

【问题讨论】:

  • 我在使用 Android 11 时遇到了类似的问题,其中 360 度全景照片存储在我的外部存储中。你能解决这个问题吗?
  • 很遗憾还没有,抱歉。好像没有人有这样的问题
  • 我不确定,我还能做什么。我尝试了外部和内部文件路径。没有任何工作。想知道我是否需要使用新的 Google API。

标签: android panoramas android-11


【解决方案1】:

我怀疑这与Android 11中引入Scoped Storage有关,但我不确定。

我已经设法使用 VR 套件组合了 Panorama API 的替代方案,我已在我的 blog post 中记录了该套件,其中包含一些代码 sn-ps。

TLDR 是这样的:

  1. 将原来的ImageView 替换为VrPanoramaView
  2. 使用VrPanoramaView的API隐藏一些选项(可选)
  3. VrPanoramaView 上覆盖一个图像按钮,并使用它在陀螺仪和触摸模式之间切换
  4. 使用触摸拦截来支持捏缩放(这将在单独的博文中)
  5. 将您的图像加载到VrPanoramaView

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-06
    • 2021-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多