Share to TikTok by using ShareSheet

Overview

This guide details how to enable sharing from your app to TikTok by using sharesheet. TikTok supports sharing video, multi-video and multi-image currently.

  • Note: The minimum TikTok version supporting sharing video is 11.3.0. The minimum TikTok version support sharing multi-image and multi-video is 14.5.0.

Sharing on Android

For all types of sharing, create an intent to send simple data to TikTok:

  • Set Intent.ACTION_SEND/ACTION_SEND_MULTIPLE for Intent's action.
  • Set the appropriate MIME type. For example image/* for sharing image and video/mp4 for shaing video.
  • Place a URI / a list of URIs pointing to the content in the extra EXTRA_STREAM.

Here is the example for sharing single-video:

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uriToImage);
shareIntent.setType("video/*");
startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to)));

Sharing multi-image:

ArrayList<Uri> imageUris = new ArrayList<Uri>();
imageUris.add(imageUri1); // Add your image URIs here
imageUris.add(imageUri2);

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "Share images to.."));
  • Note: When sharing multi-image to TikTok, TikTok will make a slideshow.

Sharing multi-video:

ArrayList<Uri> imageUris = new ArrayList<Uri>();
imageUris.add(videoUri1); // Add your video URIs here
imageUris.add(videoUri2);

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
shareIntent.setType("video/mp4");
startActivity(Intent.createChooser(shareIntent, "Share video to.."));
  • Note: When sharing multi-video to TikTok, TikTok will stitch into a long video. Users can edit the long video in TikTok.

If your shared images or videos are stored in internal storage of your app, then other apps can not access your files. When you want to share files to TikTok, you should grant permissions for these files by calling intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

PackageName for TikTok

If you don't want to call Intent.createChooser(). You can set packageName to share directly to the TikTok.

String TIKTOK_M_PACKAGE = "com.zhiliaoapp.musically";
String TIKTOK_T_PACKAGE = "com.ss.android.ugc.trill";
...
//set packagename
shareIntent.setPackage(TikTokConstant.Share.TIKTOK_M_PACKAGE);

Requirements for Media in TikTok

  • For Video:
    • Minimum video duration must be 1 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.

Downloads

For more information:https://developer.android.com/training/sharing/send