All Products
Search
Document Center

Mobile Platform as a Service:ShareService interface

Last Updated:Jun 15, 2026

The ShareService abstract class provides methods to initialize and invoke sharing across social platforms such as WeChat, Weibo, QQ, Alipay, and DingTalk.

The following code shows the ShareService interface definition:

public abstract class ShareService extends ExternalService {

    /**
     * Silent share, only one share type can be used, share type selection will not appear.
     * @param content: The content to share
     * @param shareType: Share type
     * @param biz: biz
     */
    public abstract void silentShare(ShareContent content, final int shareType, final String biz);

    /**
     * Set the monitored target in sharing
     * @param listener: The monitored target
     */
    public abstract void setShareActionListener(ShareActionListener listener);

    /**
     * Obtain the monitored target in sharing
     * @return: The monitored target
     */
    public abstract ShareActionListener getShareActionListener();

    /**
     * Set the name of application
     * @param name: Application name
     */
    public abstract void setAppName(String name);

    /**
     * Initialize WeChat sharing
     * @param appId: WeChat appId, registered and obtained from WeChat channel
     * @param appSecret: WeChat appSecret, registered and obtained from WeChat channel
     */
    public abstract void initWeixin(String appId, String appSecret);

    /**
     * Initialize Weibo sharing
     * @param appId: Weibo appId, registered and obtained from Weibo channel
     * @param appSecret: Weibo appSecret, registered and obtained from Weibo channel
     * @param redirectUrl: The redirect URL for Weibo sharing
     */
    public abstract void initWeiBo(String appId, String appSecret, String redirectUrl);

    /**
     * Initialize Qzone sharing
     * @param appId: QZone appId, registered and obtained from QQ channel
     */
    public abstract void initQZone(String appId);

    /**
     * Initialize QQ sharing
     * @param appId: QQ appId, registered and obtained from QQ channel
     */
    public abstract void initQQ(String appId);

    /**
     * Initialize Alipay sharing
     * @param appId: Alipay appId, registered and obtained from Alipay channel
     */
    public abstract void initAlipayContact(String appId);

    /**
     * Initialize DingTalk sharing
     * @param appId: DingTalk appId, registered and obtained from DingTalk channel
     */
    public abstract void initDingDing(String appId);

}