SoFunction
Updated on 2025-03-11

Android WeChat picture sharing function

We all know that through WeChat official sharing SDK, there are many ways to support image sharing. The official link can be viewed directly, and will not be repeated.

The problem to be solved in this article is to share local pictures with QR codes to WeChat friends and friends circles. Pictures in Moments can be recognized by long pressing and long pressing. The pictures in the WeChat friends dialog box can be recognized normally on iOS, but they cannot be recognized on Android. Why?

The following quotes netizens’ answers:

After analysis and function comparison, there are two ways to browse the image in the Android Wechat app, image preview, and open viewing (this page has recognition action) after the image is sent locally. The preview image function does not include the recognition function of long press gestures. If you observe carefully, you can see that iOS devices send QR code pictures to the chat record. Android opens the preview function. Long press does not have the QR code recognition function. However, when Android saves this image and sends it again, it can be recognized. There is no problem with the picture, but the function implementation of wechat android version is not equal to iOS.

Through the systemACTION_SEND Components can solve the above problems.

< class="language-java hljs "> /**
   * Share pictures to WeChat
   * @param path Picture of local path
   */
 private void shareWeChat(String path){
  Uri uriToImage = (new File(path));
  Intent shareIntent = new Intent();
  //Send pictures to friends  //ComponentName comp = new ComponentName("", "");
  //Send pictures to friends.  ComponentName comp = new ComponentName("", "");
  (comp);
  (Intent.ACTION_SEND);
  (Intent.EXTRA_STREAM, uriToImage);
  ("image/jpeg");
  startActivity((shareIntent, "Share pictures"));
 }