Share mp3 via whatsapp, Android -
i'm developing application has share mp3 file via whatsapp.
my code @ moment following:
final intent shareintent = new intent(android.content.intent.action_send); shareintent.settype("audio/mp3"); shareintent.setpackage("com.whatsapp"); uri recurso = uri.parse("android.resource://com.yayo.yayobotonera/" + r.raw.audio1); shareintent.putextra(android.content.intent.extra_stream, recurso); startactivity(intent.createchooser(shareintent, getstring(r.string.text1)));
i can share via gmail, example, it's not working via whatsapp. problem of code or whatsapp doesn't allow share mp3 files?
thanks in advance!
use this::
final intent sendintent = new intent(intent.action_send); sendintent.putextra("sms_body", "bod of sms"); sendintent.settype("*/*"); sendintent.setclassname("com.android.mms", "com.android.mms.ui.composemessageactivity"); final file file1 = new file(environment.getexternalstoragedirectory().getabsolutepath(),"test.amr"); uri uri = uri.fromfile(file1); log.e("path", "" + uri); sendintent.putextra(intent.extra_stream, uri); startactivity(intent.createchooser(sendintent, ""));
Comments
Post a Comment