Sharing on Android


This guide details how to enable sharing from your app to TikTok. After sharing successfully to TikTok, users will see your app's name in TikTok feed.

Note: The minimum TikTok version supporting sharing is 11.3.0.


Before you can share to TikTok from your App, make sure you have obtained a Client Key from TikTok and installed the TikTok SDK to your Android project. For details on these requirements, see Getting started.

Detailed Steps

Edit your Application

First you need to initialize TikTokOpenApiFactory by using client key in your custom Application.

public void onCreate() {
    String clientkey = "[CLIENT_KEY]"; 
    TikTokOpenApiFactory.init(new TikTokOpenConfig(clientkey));

Edit Your Manifest

  1. Open the /app/manifest/AndroidManifest.xml file.
  2. Register TikTokEntryActivity for receiving callbacks in Manifest. If you have customized an activity to receive callbacks, you may skip this step.
//If you have customized activity to receive callnacks,you can skip the step

Send Share Request

  1. Create a TiktokOpenApi to send share request.
  2. Build share content for images/videos into the TikTokMediaContent model.
  3. Create Share.Request instance and set required parameters: request.mMediaContent = [TikTokMediaContent].
  4. Call method Share() in TiktokOpenApi .
//1.create TiktokOpenApi
TiktokOpenApi tiktokOpenApi= TikTokOpenApiFactory.create(this);

Share.Request request = new Share.Request();
//initialize the resource path, please provide absolute path
ArrayList<String> mUri = new ArrayList<>();
mUri.add ...

// share content for photos/videos into TikTokMediaContent 
TikTokVideoObject videoObject = new TikTokVideoObject();
videoObject.mVideoPaths = mUri;
TikTokMediaContent content = new TikTokMediaContent();
content.mMediaObject = videoObject;
//3.set required parameters
request.mMediaContent = content;

// or share multi-picture,here the size of mUri must >=2
TikTokImageObject imageObject = new TikTokImageObject();
imageObject.mImagePaths = mUri;
TikTokMediaContent mUediaContent = new TikTokMediaContent();
mediaContent.mMediaObject = imageObject;
request.mMediaContent = content;

//4.start share

After a successful sharing session, a Dialog will prompt for the user to choose Back to your App or Stay in TikTok.

If you want to receive callbacks when people stay in TikTok , please register to receive a broadcast :

public static final String ACTION_STAY_IN_TT = "";

Parameters in Share.Request

mMediaContentYou can build share content for videos or photos using following models:
1.multi-Image: see TikTokImageObjectmodel .
Note: The size of Images must more than one and up to 12.
2.single-video\multi-video: see TikTokVideoObjectmodel.
Then assign required parameter as request.mMediaContent = [TikTokMediaContent];
callerLocalEntrySet customized callback Activity by using request.callerLocalEntry = ""; If this parameter is not set, TikTok will callback TikTokEntryActivity in default.

Receive Callbacks

We provides two ways for you to receive the callback data from TikTok.

  1. Create new activity named "TikTokEntryActivity" in your app and implement TikTokApiEventHandler interface.
    Note: The path of the activity should be your "package name" + .tiktokapi.TikTokEntryActivity. For example, "com.tiktok.opensdk.tiktokapi.TikTokEntryActivity".

    The following example shows how to use the TikTokEntryActivity to receive the callback data.

    class TikTokEntryActivity extends Activity implements TikTokApiEventHandler {
       TiktokOpenApi ttOpenApi;
       public void onCreate(@Nullable Bundle savedInstanceState) {
           ttOpenApi= TikTokOpenApiFactory.create(this);
           ttOpenApi.handleIntent(getIntent(),this); // receive and parse callback
       public void onReq(BaseReq req) {
       public void onResp(BaseResp resp) {
           if (resp.getType() == TikTokConstants.ModeType.SHARE_CONTENT_TO_TT_RESP)  {
               Share.Response response = (Share.Response) resp;
               Toast.makeText(this, " code:" + response.errorCode + " errorMessage:" + response.errorMsg, Toast.LENGTH_SHORT).show();
       public void onErrorIntent(@Nullable Intent intent) {
           Toast.makeText(this, "Intent Error", Toast.LENGTH_LONG).show();
  2. You can also customize your own activity to receive the callback; just implement the interface TikTokApiEventHandler and set your activity path by using parameter "callerLocalEntry".

// request.callerLocalEntry = "";

In the table below, each row represents error code. For further information please see the TikTokConstants.

-1Unknown error
-2User cancelled
-3Send failed

Requirements for Media

  • For Video:
    • Minimum video duration must be 3 seconds
    • Supported video media type: .mp4
    • The Minimum of the frame size should be no more than 1100
  • For multi-Video:
    • The number of Videos can be no more than 12.
  • For multi-Image:
    • The number of images should be more than 1 and up to 12.
  • Videos cannot contain brand logos or watermarks. Violating this guideline will lead to videos being deleted or accounts being banned. Make sure your applications share content without watermarks or brand logos.