问题
I need to send contact via SMS. So, I'm using .vcf file.
Still, I need to attach it to sms within android SDK. There IS such function within android. I've tried it on my smartphone;
I was searching for the way to do that for days and everything I've found so far was this nice library to construct vCard and this method of SMSManager class.
Does anyone know how to do that??? I suppose solution of this problem shall work not only for vcf, but for any file extension.
If you'll add some code as an example you will make me happy))
回答1:
Since you have a File object, you can send MMS with it, by using this code
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/x-vcard");
sendIntent.putExtra(Intent.EXTRA_STREAM,
Uri.parse(outputFile.toURL().toString()));
startActivity(sendIntent);
回答2:
I think you need to use MMS intends of SMS AFAIK SMS is just text and in MMS you can add files.
see the following stackoverflow question and also this blog entry
来源:https://stackoverflow.com/questions/10420312/android-how-to-attach-file-to-sms