简体   繁体   English

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

[英]Google+ app showing wrong pictures when sharing through Android

I have programmatically added Google+ sharing to my app. 我已通过编程方式将Google+共享添加到了我的应用中。 I have a set of photos that I include with my posts and share with the following code: 我的帖子中包含一组照片,并与以下代码共享:

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

When this code gets executed, the Google+ app on my phone is started and I get a preview that has the images and text as expected. 执行此代码后,手机上的Google+应用将启动,并且预览显示的图片和文字符合预期。

However, if I run this more than once and include different images on subsequent runs, the original images show up in the Google+ post preview instead of the new ones. 但是,如果我多次运行此图像,并在以后的运行中包含不同的图像,则原始图像将显示在Google+帖子预览中,而不是新图像。 If I submit the post, the correct images show up in the post--the new ones, not the original ones. 如果我提交该帖子,则正确的图像会显示在该帖子中-新的而不是原始的。

I presume the Google+ app has some kind of caching mechanism. 我认为Google+应用程序具有某种缓存机制。 Is there a way to programmatically clear that cache so that the correct images show up in the Google+ app post preview? 是否可以通过编程方式清除该缓存,以便在Google+应用发布后预览中显示正确的图像?

Thanx in advance. 提前感谢。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM