All Products
Search
Document Center

Mobile Platform as a Service:ShareType

Last Updated:May 21, 2021

This topic describes how to use the ShareType operation, as shown in the following code:

  1. public class ShareType {
  2. /**
  3. * Share as a text message.
  4. */
  5. public static final int SHARE_TYPE_SMS = 2;
  6. /**
  7. * Share to Weibo.
  8. */
  9. public static final int SHARE_TYPE_WEIBO = 4;
  10. /**
  11. * Share to a WeChat friend.
  12. */
  13. public static final int SHARE_TYPE_WEIXIN = 8;
  14. /**
  15. * Share to Moments in WeChat.
  16. */
  17. public static final int SHARE_TYPE_WEIXIN_TIMELINE = 16;
  18. /**
  19. * Copy the link.
  20. */
  21. public static final int SHARE_TYPE_LINKCOPY = 32;
  22. /**
  23. * Share to Qzone.
  24. */
  25. public static final int SHARE_TYPE_QZONE = 256;
  26. /**
  27. * Share to a QQ friend.
  28. */
  29. public static final int SHARE_TYPE_QQ = 512;
  30. /**
  31. Share to a contact.
  32. */
  33. public static final int SHARE_TYPE_CONTACT = 1024;
  34. /**
  35. * Share to Contact Timeline.
  36. */
  37. public static final int SHARE_TYPE_CONTACT_TIMELINE = 2048;
  38. /**
  39. * Share to DingTalk.
  40. */
  41. public static final int SHARE_TYPE_DINGDING = 4096;
  42. /**
  43. * Share to Group.
  44. */
  45. public static final int SHARE_TYPE_GROUP = 8192;
  46. /**
  47. * Share to all the platforms.
  48. */
  49. public static final int SHARE_TYPE_ALL = 65535;
  50. }

Precautions

  • When you share a text to WeChat, set the Url, Image, and ImgUrl to null in the ShareContent class in the ShareContent operation.

    1. shareContent.setUrl(null);
    2. shareContent.setImage(null);
    3. shareContent.setImgUrl(null);
  • When you share a text to Weibo, set the Url to a space and the Image and ImgUrl to null in the ShareContent class in the ShareContent operation.

    1. shareContent.setUrl(" ");
    2. shareContent.setImage(null);
    3. shareContent.setImgUrl(null);