我是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