android - Google PanoramaAPI 停止在 Android 11 上运行
问题描述
我的应用程序中有 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/<applicationId>/files/*.jpg
. 不幸的是,全景视图无法加载图像并且viewerIntent
总是null
。
对我来说,这看起来像是 Android 11 上的权限问题,但我不知道如何解决。我不想将图像下载到手机的更公共区域。有谁知道如何解决它?
解决方案
我怀疑这与 Android 11 中引入Scoped Storage有关,但我不确定。
我已经设法使用 VR Kit 组合了 Panorama API 的替代方案,我已经在我的博客文章中记录了一些代码片段。
TLDR 是这样的:
- 将您的原件替换
ImageView
为VrPanoramaView
- 使用
VrPanoramaView
的 API 隐藏一些选项(可选) - 在 上覆盖图像按钮
VrPanoramaView
并使用它在陀螺仪和触摸模式之间切换 - 使用触摸拦截来支持捏缩放(这将在单独的博客文章中)
- 将图像加载到
VrPanoramaView
推荐阅读
- ruby-on-rails - 我无法在我的 Ruby on Rails 应用程序中集成 Bootstrap
- c# - 无法以 Windows-1252 编码写入文件,改为使用 UTF-8
- python - 无需在 Python 中写入磁盘即可加入 .wav 文件
- latex - 打破页面中的长算法
- python-3.x - 通过与一组项目进行比较的数据框的 GroupBy
- css - CSS:具有模糊效果的四个侧面的盒子阴影
- php - 为什么每次登录后的数据没有存储在我的数据库中?
- php - AJAX调用将数据导出到excel
- c# - 在 Polly 重试策略中重用 HttpRequestMessage
- python - 将 numpy digitize bin 列名匹配到输入列表