2013-05-02 57 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);