0
對不起,如果這個問題已經被問到或似乎很愚蠢,但我卡住了。我正在編寫一個Android應用程序,在該應用程序中,應用程序向不同的人發送不同的消息,第一個成功發送,但第二個發生了問題,它不會向我顯示錯誤,但它不會發送第二個消息。我的代碼如何從Android應用程序發送多條短信?
public void sendSMSMessenger(){
Log.i("Send SMS", "");
try {
// SmsManager smsManager = SmsManager.getDefault();
SmsManager.getDefault().sendTextMessage(Emergencyphonenumber, null, "There is an emergency with your "+PatientRelationship+" "+Patientname+" please open the link to find the location "+"https://www.google.com/maps/place/"+latitude+","+longitude, null, null);
Toast.makeText(this, "Message Sent (Relative)", Toast.LENGTH_SHORT).show();
SmsManager.getDefault().sendTextMessage(Doctorphonenumber, null, "There is an emergency with your patient named "+Patientname+" please open the link to find the location "+"https://www.google.com/maps/place/"+latitude+","+longitude, null, null);
Toast.makeText(this, "Message Sent (Doctor)", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Toast.makeText(this, "Message Sending failed", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
謝謝....
這是因爲當您試圖一個接一個地發送消息時,網絡被卡住了。所以解決方法是,等待15-30秒後嘗試發送下一條消息。希望你明白。 – Lal
@Lal,你能否澄清一下你的意思是「__ network is jammed__」? –