我是Android新手,我試圖通過Android應用程序發送短信。我需要它,例如,如果消息包含單詞「MYSELF」提示用戶是否要繼續發送短信我的方法是:發送短信之前提示Android Android
public void sendSmsByManager() {
try {
// Get the default instance of the SmsManager
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNumber.getText().toString(),
null,
smsBody.getText().toString(),
null,
null);
//If the SMS Contains the WORD MYSELF Prompt the User If they Want to send the SMS
Toast.makeText(getApplicationContext(),
"Your sms has successfully sent!",
Toast.LENGTH_LONG).show();
} catch (Exception ex) {
Toast.makeText(getApplicationContext(), "Your sms has failed...",
Toast.LENGTH_LONG).show();
ex.printStackTrace();
}
}
我怎樣才能做到這一點?
你想在用戶發送文本對自己這個觸發,當用戶從字面上將消息發送到「我」或乾脆當消息包含文字「我自己」? – Andreas
當文本包含單詞「我自己」 – ErrorNotFoundException