簡體   English   中英

如何執行默認短信應用程序?

[英]How can I execute default sms app?

我注冊了接收者以獲得短信。 收到短信后,如何執行手機的默認短信應用程序?

我可以使用意圖發送操作來啟動默認的SMS應用程序嗎?

可以通過幾種不同的方式來完成。 這是一個:

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", "Content of the SMS goes here..."); 
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
Here "number" is an array of strings with the numbers of contacts to whom you want to send sms to and "älldetails" is teh string you want to send. 


 String n = "";
for(int i = 0; i<sizesf ;i++)
{
        if(i == (sizesf-1))
        {

            n = n + number[i];
        }

        else 
            n = n + number[i] + ";";

}  


Log.d("numbers in intent", n);

Intent smsIntent = new Intent( Intent.ACTION_VIEW, Uri.parse( "smsto:"+ n) );
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.putExtra("address", n );
smsIntent.putExtra("sms_body",alldetails);
startActivity(smsIntent);

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM