Google+ app showing wrong pictures when sharing through Android

北慕城南 提交于 2019-12-11 02:49:30

问题


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.


回答1:


Try assigning different random names to your source files (by renaming or copying) on each run



来源:https://stackoverflow.com/questions/22116793/google-app-showing-wrong-pictures-when-sharing-through-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!