通过 Android 共享时 Google+ 应用程序显示错误的图片

2024-03-13

我已以编程方式将 Google+ 共享添加到我的应用程序中。我有一组照片,我将其包含在我的帖子中并使用以下代码共享:

private void shareToGooglePlus() {
  // Launch the Google+ share dialog with attribution to your app.
  PlusShare.Builder share = new PlusShare.Builder(this);

  for (String imageFilename : imageList) {
    Uri imageUri = Uri.fromFile(new File(imageFilename));
    share.addStream(imageUri);
  }

  share.setText("My images");
  share.setType("image/jpeg");

  startActivityForResult(share.getIntent(), 0);
}

执行此代码后,我手机上的 Google+ 应用程序将启动,并且我会获得包含预期图像和文本的预览。

但是,如果我多次运行此操作并在后续运行中包含不同的图像,则原始图像会显示在 Google+ 帖子预览中,而不是新图像中。如果我提交帖子,帖子中会显示正确的图像 - 新图像,而不是原始图像。

我认为 Google+ 应用程序有某种缓存机制。有没有办法以编程方式清除该缓存,以便在 Google+ 应用发布预览中显示正确的图像?

提前致谢。


尝试在每次运行时为源文件分配不同的随机名称(通过重命名或复制)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

通过 Android 共享时 Google+ 应用程序显示错误的图片 的相关文章

随机推荐