SendIntent issue

50 views
Skip to first unread message

Ferhat

unread,
Aug 24, 2026, 9:31:38 AMAug 24
to DroidScript

I’ve tried many different methods, but I still haven’t been able to solve the problem. I’m trying to send a video via WhatsApp, but nothing happens. Did I do something wrong?



Example code:
function shareVideoToWhatsApp(videoPath) {
    var contentUri = app.Path2Uri(videoPath);
    alert("URI: " + contentUri);

    var extras = [
        { name: "android.intent.extra.STREAM", type: "uri", value: contentUri }
    ];

    app.SendIntent(
        "com.whatsapp",
        null,
        "android.intent.action.SEND",
        null,
        null,
        "video/mp4",
        extras,
        "Result",
        function(resultCode, data) {
            alert("Result: " + resultCode);
        }
    );
}

shareVideoToWhatsApp("a.mp4");

Dave

unread,
Aug 30, 2026, 11:39:10 AMAug 30
to DroidScript
Try this - 

function shareVideoToWhatsApp(videoPath) {
    if (!app.FileExists(videoPath)) {
        alert("File not found: " + videoPath);
        return;
    }

    var contentUri = app.Path2Uri(videoPath);

    var extras = JSON.stringify([
        {

            name: "android.intent.extra.STREAM",
            type: "uri",
            value: contentUri
        }
    ]);


    app.SendIntent(
        "com.whatsapp",
        null,
        "android.intent.action.SEND",
        null,
        null,
        "video/mp4",
        extras
    );
}

shareVideoToWhatsApp("a.mp4");

Dave

unread,
Aug 30, 2026, 11:39:38 AMAug 30
to DroidScript
Also, try this - 

app.SendFile("a.mp4", "", "", "Share video");

Dave

unread,
Aug 30, 2026, 11:46:11 AMAug 30
to DroidScript
That first script above might need this adding to the sendintent method internally- 

i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

So I will add that to  v2.80 (and V3)

Alan Hendry

unread,
Aug 30, 2026, 12:22:03 PMAug 30
to DroidScript
HI,
First I'd use the Whatsapp directly to test that the format is compatible
(Video Codec:  H.264 and AAC)
Then check for errors in the DS debug.
What version of Android is this?
Where is the mp4 (try other locations)?
Regards, ah

Dave

unread,
Sep 1, 2026, 4:52:31 PMSep 1
to DroidScript
I recommend using this version for testing - https://droidscript.org/download/v2.80/
Reply all
Reply to author
Forward
0 new messages