2013-05-02 56 views
1

enter image description here我试图使用SmsManager将文本messages发送到手机上的选定联系人,但默认情况下,它使用电话GSM消息选项发送消息。我的要求是,以弹出展现给用户选择的消息选项,如WHATSAPPVIBER等作为图像如何在Android中显示所有消息传递选项的对话框?

这里所示是我的代码

SmsManager sm = SmsManager.getDefault(); 
sm.sendTextMessage("9844598445", null, "Hello There", null, null); 

请帮

回答

3

试试这个

Uri uri = Uri.parse("smsto:" + smsNumber); 
Intent intent = new Intent(Intent.ACTION_SENDTO, uri); 
intent.putExtra("sms_body", smsText); 
startActivity(intent); 
1

什么你”现在重做直接通过SDK发送短信。如果你想向用户提供选择通过其他安装的应用程序发送它,你需要使用一个意图:

Uri uri = Uri.parse("smsto:1234567890"); 
Intent it = new Intent(Intent.ACTION_SENDTO, uri); 
it.putExtra("sms_body", "The SMS text"); 
startActivity(it);