2
votes

I'm trying to share an audio(.mp3) from a 3rd app to my android app. When I receive the audio and I get the intent info (Uri soundUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM)), the Uri has wrong data. The path is correct but the filename has been renamed with numbers (5348 for example) and no extension, the real filename was AUDIO-6151616.mp3

So, full path is /storage/emulated/0/Download/AUDIO-6151616.mp3 but my Intent Uri is /storage/emulated/0/Download/5348

If I share this audio from another 3rd party app (I’m using file explorer apps) it seems to work fine, but if I use others apps or even “Native” Downloads app (on Moto G) it does not.

What am I missing?

Thanks in advance

1
"What am I missing?" -- you are missing a minimal reproducible example. My guess is that you are also missing how to use a Uri properly. - CommonsWare

1 Answers

1
votes

You should check out the official training docs for sharing. You should always expect content:// uri's like content://Download/5348. Because your suppose to call getContentResolver().openInputStream(uri). So you can just end up using the ShareCompat.IntentReader.

Other recommended research to watch is: