Skip to content Skip to sidebar Skip to footer

Android Intent Share To Share A Video Url On Facebook

On my android app, I want to share a video url on facebook, i've tried two ways. One: Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType('

Solution 1:

After several hours of trying to find out how to make it work for uploading and sharing video on facebook, youtube, instagram and whatsapp. this is the code that worked for me. Uploading recorded video from your application to social media applications

try using ContentValues when dealing with videos.

ContentValuescontent=newContentValues(4);
        content.put(Video.VideoColumns.DATE_ADDED,
        System.currentTimeMillis() / 1000);
        content.put(Video.Media.MIME_TYPE, "video/mp4");
        content.put(MediaStore.Video.Media.DATA, "your_path_to_video");
        ContentResolverresolver= getBaseContext().getContentResolver();
        Uriuri= resolver.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, content);

        IntentsharingIntent=newIntent(android.content.Intent.ACTION_SEND);
        sharingIntent.setType("video/*");
        sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Title");
        sharingIntent.putExtra(android.content.Intent.EXTRA_STREAM,uri);
        startActivity(Intent.createChooser(sharingIntent,"share:")); `

Post a Comment for "Android Intent Share To Share A Video Url On Facebook"