All Products
Search
Document Center

Mobile Platform as a Service:Quick start

Last Updated:Jan 30, 2026

This topic describes how to quickly integrate the Social Share SDK.

About this task

The Social Share component enables you to share content through various channels, such as Weibo, WeChat, Alipay, QQ, DingTalk, and text messages. It provides a unified interface for developers, so you do not have to manage the differences between each SDK. To integrate the Share component into an Android client, you must configure your project and add the share component SDK.

Prerequisites

Before you integrate with a channel, you must apply for an account on its official website. Examples include the following:

Social Share supports two connection types: native AAR and component-based.

Add the SDK

Native AAR method

For more information, see AAR Component Management. Use Component Management (AAR) to install the Share component in your project.

Component-based method

In your Portal and Bundle projects, use Component Management to install the Share component. For more information, see Manage component dependencies.

Initialize mPaaS

If you use the native AAR method, you must initialize mPaaS by adding the following code to your Application:

public class MyApplication extends Application {
    
    @Override
    public void onCreate() {
        super.onCreate();
        // Initialize mPaaS
        MP.init(this);    
    }
}

For more information, see Initialize mPaaS.

Use the Share SDK for each platform

This topic uses the official Social Share demo to demonstrate how to use the Social Share SDK in baselines 10.1.32 and later.

WeChat Share

You must manually create an Activity to receive callback events from WeChat Share. This Activity must have a specific path and name. It must inherit from DefaultWXEntryActivity, and its path must be package_name.wxapi.WXEntryActivity, where package_name is your application's package name.

Note

The path and Activity name must be exact. Otherwise, you will not receive callbacks.

In this example, the package name is com.mpaas.demo:

package com.mpaas.demo.wxapi;
import com.alipay.android.shareassist.DefaultWXEntryActivity;
public class WXEntryActivity extends DefaultWXEntryActivity {
}

Register this Activity in AndroidManifest.xml:

<application>
      ···
      <activity android:name="com.mpaas.demo.wxapi.WXEntryActivity"
      android:exported="true"
      android:launchMode="singleTop">
			</activity>
      ···
</application>
Note

When you set the share icon, make sure its size does not exceed 32 KB. If it does, WeChat sharing might fail. The Android SDK currently checks the icon size. If an icon is larger than 32 KB, the SDK replaces it with the default Alipay icon.

QQ and QZone Share

You must register the required Activity for QQ sharing in AndroidManifest.xml. Otherwise, the share and callback features for QQ and QZone will not work.

Note
  • If the QQ Share ID that you enter in AndroidManifest.xml does not match the one registered in your code, QQ Share callbacks will be disrupted. The onException callback is triggered even if the sharing is successful. Ensure that the IDs match.

  • In data android:scheme, you must enter the corresponding QQ Share ID. The format is tencent followed by your QQ ID. You must apply for this ID on the Tencent Open Platform. In the following example, the QQ ID is 1104122330.

<application>
      ···
      <activity
            android:name="com.tencent.connect.common.AssistActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
      <activity
            android:name="com.tencent.tauth.AuthActivity"
            android:launchMode="singleTask"
            android:exported="true"
            android:noHistory="true">
            <intent-filter>
                  <action android:name="android.intent.action.VIEW"/>
                  <category android:name="android.intent.category.DEFAULT"/>
                  <category android:name="android.intent.category.BROWSABLE"/>
                  <data android:scheme="tencent1104122330"/>
            </intent-filter>
      </activity>
      ···
</application>

Weibo Share

Ensure that your application signature, package name, and Share ID match the information registered on the Weibo Open Platform. A mismatch will cause sharing to fail. If sharing fails due to a mismatch, the share component's callback triggers onComplete instead of onException. This is a known bug in the Weibo SDK that also occurs in the official Weibo SDK demo.

Related links