Android 发送彩信时不包括以下内容:;短信“你的身体”;
我正在尝试使用以下代码通过彩信发送图像Android 发送彩信时不包括以下内容:;短信“你的身体”;,android,mms,Android,Mms,我正在尝试使用以下代码通过彩信发送图像 Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra("sms_body", "Hi there"); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url)); sendIntent.setType("image/png"); 它打开消息应用程序并附加消息,但它没有写“sms_body”,在我的例子中是
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra("sms_body", "Hi there");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
sendIntent.setType("image/png");
它打开消息应用程序并附加消息,但它没有写“sms_body”,在我的例子中是“Hi there”。为什么?试试这个:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
intent.putExtra("subject", "subject");
intent.putExtra("sms_body", "Hi there");
intent.putExtra("address", "Phonenumber");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
intent.setType("image/png");
startActivity(intent);
看起来效果不错的是,我刚刚添加了额外的_文本(一个@yasserbn在评论中提供的解决方案): 除此之外:
intent.putExtra("sms_body", default_message);
无论它是转换成彩信还是作为普通短信发送,它似乎都能起作用 它显示:应用程序意外停止。请重试。在intentIt中添加标志\u活动\u新任务后重试无效。它看起来可以在Handcent短信上运行。当菜单出现并且我选择Handcent时,sms正文将包括在内。但它不会显示在消息应用程序中。您正在真实设备上测试吗?我知道了,请使用intent.putExtra(intent.EXTRA_TEXT,“您好”);而不是意图。putExtra(“sms_body”,“你好”);
intent.putExtra("sms_body", default_message);