Saeed Jassani
Saeed Jassani

Reputation: 1079

android - Send data to a specific app with intent

I am passing a RTMP video URL to the MX Player app. But I need to force start MX Player when the intent is started instead the user chooses the MX Player manually. I tried this:

i=getPackageManager().
getLaunchIntentForPackage("com.mxtech.videoplayer.ad");
i.setData(Uri.parse("MY_URL"));
startActivity(i);

When I run this MX Player force closes. Any help will be appreciated.

Upvotes: 2

Views: 2412

Answers (2)

Amit Vaghela
Amit Vaghela

Reputation: 22945

you can use this MX player API

here is sample

 Intent intent = new Intent(Intent.ACTION_VIEW); 
    intent .setPackage("com.mxtech.videoplayer.ad");
    Uri videoUri = Uri.parse("http://host:port/playlist.m3u8");  
    intent.setDataAndType( videoUri, "application/x-mpegURL" );
             intent.setPackage( "com.mxtech.videoplayer.pro" );
         startActivity( intent );

full API doc.

Upvotes: 2

Developer110
Developer110

Reputation: 182

You can try this. This will work for sure:

i.setPackage("com.mxtech.videoplayer.ad");
i.setData(URI);
startActivity(i);

Upvotes: 2

Related Questions