On the stock Droid and Nexus One, an intent like this:
new Intent(Intent.ACTION_VIEW).setDataAndType(Uri.parse("http://example.com/somemp3.mp3"), "audio/mp3");
works just fine and pops open the system music player to stream the file. But it doesn't match any activities on the HTC Incredible, causing a force-close when I call startActivity
on it (I'm guessing due to missing intent filters in SenseUI's replacement applications). I'd prefer not to have to manage a MediaPlayer instance myself if I don't have to; does anyone know if there's a way to structure an Intent to convince the Incredible to play an MP3 stream over HTTP in its built-in Music or Streaming Media apps?
Try "audio/*" type. I think it works.
This code worked for me:
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse(url), "audio/*");
context.startActivity(i);
You can also view video streaming, using "video/*" type.
This method worked on both Android 1.5 and 2.2, not sure about SenseUI compatibility. "audio/mp3" didn't work for me either, so it's not senseUI specific.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With