Sending MMS into different Android devices

六月ゝ 毕业季﹏ 提交于 2019-12-01 13:49:05

问题


I need to send MMS. Into my hero this code looks ugly but works:

Intent sendIntent = new Intent("android.intent.action.SEND_MSG"); 
   sendIntent.putExtra("address", toText); 
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "subject");

sendIntent.putExtra("sms_body", textMessage); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
sendIntent.setType("image/jpeg"); 
startActivity(sendIntent);

But it seems to me that on the other devices it doesn't work at all. I want to send directly to main messaging app without any choices(the better solution of course - direct from my app). Because not sure that all of them would handle it properly. If anybody could recommend any third-party library I'll be appretiate.


回答1:


Have you tried something like this (change to your need and add images etc...):

Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mmsto:<number>");
intent.putExtra("address", <number>);
intent.putExtra("subject", <subject>);
startActivity(intent);

The above is the best I could come up with which works on HTC/Nexus/SE from 1.6 to 2.2.




回答2:


send from your app ?

before startActivity, you can

intent.setClassName("your package name", "your class name");

startActivity(intent);




回答3:


You could try something like this.Which will launches all the apps which can handle the intent.

intent.setAction(Intent.ACTION_SEND);
//In case of multiple file
intent.setAction(Intent.ACTION_SEND_MULTIPLE);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, <List of uris>);
intent.putExtra(Intent.EXTRA_STREAM, <singleUri>);
intent.setType("*/*");
startActivity(intent);


来源:https://stackoverflow.com/questions/2165516/sending-mms-into-different-android-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!