question

sploink avatar image
sploink asked

Playback .wav files with ACTION_VIEW intent

Hello, I was hoping someone can help me out with a problem I'm having. Kindle documentation shows that ACTION_VIEW is supported for launching activities. https://developer.amazon.com/sdk/fire/intents-supported.html#_ACTION_VIEW The piece of code I have below doesn't do anything. The file itself exists. On stock Android devices this code properly brings up the media player to play the .wav file I am pointing to. I am testing this on a Kindle Fire 2nd Gen (KFOT) device. File file = new File("/path/to/file"); Intent i = new Intent(Intent.ACTION_VIEW); i.setDataAndType(Uri.fromFile(file), "audio/*"); getContext().startActivity(i); Any ideas or suggetsions? Thanks
fire tablet
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Sploink, Thank you for the post. I tested your code in KF 2nd Gen and it worked as expected. While launching the activity with given intent contains a .wav audio file data for ACTION_VIEW, I am getting a list of compatible players (Amazon MP3, ES Media Player etc) on top of my activity. And the player I select there is able to play the wav media (stored in sd card) as well. Do you see any error report in logcat while you are trying the same? Also, check the path of media you are giving to the File instance. Below is the code I used, File file = new File("/mnt/sdcard/adios.wav"); Intent i = new Intent(Intent.ACTION_VIEW); i.setDataAndType(Uri.fromFile(file), "audio/*"); startActivity(i); Hope this helps.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.