Search code examples
javaandroidandroid-intentandroid-sharing

How to share/send Video Data to Tik-Tok app via Intent through my app, just like gallery sharing


I need to share a video Uri to tik-tok, instagram, youtube where I am able to share to instagram and youtube by just putting Intent.EXTRA_STREAM, but this is not working for tik-tok. our gallery app can share data to tik-tok so it is damn possible to do so.

Intent sharingIntent = new Intent(Intent.ACTION_SEND);

sharingIntent.putExtra(Intent.EXTRA_STREAM, mediaUri);

sharingIntent.setType("video/*");
sharingIntent.setPackage("com.zhiliaoapp.musically");
startActivity(sharingIntent);

just opening tik-tok app, not redirecting to the sharing procedure, can be compared with gallery


Solution

  • Share to TikTok by using ShareSheet

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

    More description here:https://developers.tiktok.com/doc/video-kit-sharesheet-sharesheet-for-android