Todos os produtos
Search
Central de documentação

Mobile Platform as a Service:Interface ShareService

Última atualização: Jun 28, 2026

A classe abstrata ShareService fornece métodos para inicializar e acionar o compartilhamento em plataformas sociais como WeChat, Weibo, QQ, Alipay e DingTalk.

O código a seguir mostra a definição da interface ShareService:

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);

}