0
我想从我的应用程序中使用android共享意图。使用发送意向向多人发送消息android
我在我的应用程序中列出了来自我的联系人内容提供者的所有联系人。 现在,我想使用用户手机中安装的任何消息应用程序 将消息发送给我选择的所有联系人(在我的应用程序中)。
我不想用户smsmaanger,只是想用户任何短信发送应用程序在用户移动如果 可用。 我试图用电子邮件的作品很好,但没有与短信。
我试图与电子邮件一样的伟大工程
public static void send(Context ctx, String[] addy, String subject,
String body,File attachment) {
try {
Intent sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sendIntent.setType("message/rfc822");
sendIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
addy);
sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
//sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(attachment));
ctx.startActivity(Intent.createChooser(sendIntent,
"Send via which Application?"));
} catch (Exception e) {
Toast.makeText(ctx, "No activity was found to handle this action",
Toast.LENGTH_SHORT).show();
}
}
短信我使用这样的。
public static void send(Context ctx, String addy, String subject,
String body,File attachment) {
try {
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setType("vnd.android-dir/mms-sms");
sendIntent.putExtra(android.content.Intent.EXTRA_PHONE_NUMBER,
addy);
sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
//sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(attachment));
ctx.startActivity(Intent.createChooser(sendIntent,
"Send via which Application?"));
} catch (Exception e) {
Toast.makeText(ctx, "No activity was found to handle this action",
Toast.LENGTH_SHORT).show();
}
}
我只是单纯的想我所有的联系人添加到用户信息的应用程序发送消息,以 可能
尝试下面粘贴的链接。 [发送短信到多个联系人。] [1] [1]:http://stackoverflow.com/questions/16771470/android-send-sms-to-multiple-contacts-using-arraylist – OAEI
@TrushitShah是的哥们非常有帮助的链接谢谢 – Bora