This topic describes how to use the ShareType
operation, as shown in the following code:
public class ShareType {
/**
* Share as a text message.
*/
public static final int SHARE_TYPE_SMS = 2;
/**
* Share to Weibo.
*/
public static final int SHARE_TYPE_WEIBO = 4;
/**
* Share to a WeChat friend.
*/
public static final int SHARE_TYPE_WEIXIN = 8;
/**
* Share to Moments in WeChat.
*/
public static final int SHARE_TYPE_WEIXIN_TIMELINE = 16;
/**
* Copy the link.
*/
public static final int SHARE_TYPE_LINKCOPY = 32;
/**
* Share to Qzone.
*/
public static final int SHARE_TYPE_QZONE = 256;
/**
* Share to a QQ friend.
*/
public static final int SHARE_TYPE_QQ = 512;
/**
Share to a contact.
*/
public static final int SHARE_TYPE_CONTACT = 1024;
/**
* Share to Contact Timeline.
*/
public static final int SHARE_TYPE_CONTACT_TIMELINE = 2048;
/**
* Share to DingTalk.
*/
public static final int SHARE_TYPE_DINGDING = 4096;
/**
* Share to Group.
*/
public static final int SHARE_TYPE_GROUP = 8192;
/**
* Share to all the platforms.
*/
public static final int SHARE_TYPE_ALL = 65535;
}
Precautions
When you share a text to WeChat, set the
Url
,Image
, andImgUrl
tonull
in theShareContent
class in the ShareContent operation.shareContent.setUrl(null);
shareContent.setImage(null);
shareContent.setImgUrl(null);
When you share a text to Weibo, set the
Url
to a space and theImage
andImgUrl
tonull
in theShareContent
class in the ShareContent operation.shareContent.setUrl(" ");
shareContent.setImage(null);
shareContent.setImgUrl(null);