Skip to content Skip to sidebar Skip to footer

Unable To Share Video's Url On Facebook Via Android Intent.action_send

I need to share URL on video resource programmatically. Example of URL is http://flash.video.worldnow.com/kold/KOLD_20110714204221200AA.mp4 I use Intent.ACTION_SEND for it: Intent

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 and specifying MediaStore.Video.Media.Data in the content.

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:")); `

Solution 2:

I've looked at Facebook application sources (ShareLinkActivity) and didn't found any possibility to add required fields to share request. Content of intent extra parameter Intent.EXTRA_TEXT only is used.

Solution 3:

Have a look at this page here. It looks like it wants the swfsrc and imgsrc encoded in a JSON-encoded array. Hope this helps.

Solution 4:

I searched this for almost 7 hours, following is the only solution that worked for me perfectly .

FilefilePath= filesList[position]; 
            IntentshareIntent=newIntent();
            shareIntent.setAction(Intent.ACTION_SEND);
            shareIntent.putExtra(Intent.EXTRA_TEXT, "Text");
            shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(newFile(filesList[position].getAbsolutePath())));  //optional//use this when you want to send an image
            shareIntent.setType("video/mp4");
            shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            startActivity(Intent.createChooser(shareIntent, "send"));

Post a Comment for "Unable To Share Video's Url On Facebook Via Android Intent.action_send"