Search code examples
androidandroid-intentandroid-file

Handle Intent VIEW typ=audio/mpeg


So idea is i am opening a file using apps that are already pre-installed on the device. Here is my code

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(fileUri);
intent.setType(mimeType);
startActivity(intent);

And my error message is

08-25 12:50:32.900: E/AndroidRuntime(19555): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW typ=audio/mpeg }

Any ideas how to approach this? I read about intent filters, but the guy from here told me that if I am going to use other apps to open my files then I don't need to specify any filters, is it true?

P.S. for some reason it opens PDF files just fine, and JPG and TXT

Thanks Dennis xx


Solution

  • Any ideas how to approach this?

    Install an app on your phone that has an activity that handles this MIME type. Not every possible MIME type will be handled by the apps already on your device.

    If you think that such-and-so app on your device ought to be able to handle this, use AppXplore to examine its manifest and see where you are going wrong (e.g., fileUri is using an unsupported scheme).