简体   繁体   中英

Google+ app showing wrong pictures when sharing through Android

I have programmatically added Google+ sharing to my app. 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.

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. 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. Is there a way to programmatically clear that cache so that the correct images show up in the Google+ app post preview?

Thanx in advance.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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