opening text messaging app with attachment

  • Thread starter Android Central Question
  • Start date
A

Android Central Question

I'm trying to start an Intent from a Unity app that will launch the text messaging app with an attachment.

I have been able to open the text messaging app but the attachment does not load properly, throwing the following exception:

'Could not determine type of file:///storage/emulated/0/Android/data/com.torpedoesaway.memematch/files/Gifit2MemeFiles/gifit2meme-2019-09-7-09-39-54.gif
java.io.IOException: java.lang.RuntimeException: setDataSource failed: status = 0x80000000'

Note that I have also tried loading other images, such as pngs and jpgs, all throwing the same error.

This is my intent code:

Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("smsto:" + recipient));
intent.putExtra("sms_body", message);
intent.putExtra(Intent.EXTRA_STREAM, attachment);

if (intent.resolveActivity(activity.getPackageManager()) != null) {
activity.startActivity(intent);
}

Now, I tried playing around with the intent action as well as the setData/setType calls and in one instance I am able to open the chooser, select the messaging app and then the attachment is loaded properly. However, I want to open the text messaging app directly with the attachment working.

Thanks in advance for the help!
 

SpookDroid

Ambassador
Jul 14, 2011
19,299
555
113
Visit site
I know nothing of programming in this case, but are there different commands for MMS? Since SMS doesn't support any kind of media attachment, might that be why you're given an error?
 

Trending Posts

Forum statistics

Threads
943,176
Messages
6,917,645
Members
3,158,860
Latest member
smokedog87