0
此处地址存储设备的当前位置,该位置可用。我得到一个表示SMS已发送的祝酒,但实际上没有从设备发送短信。如果在查找位置之前使用相同的代码,则它可以很好地工作。Android代码发送无误但仍未发送的短信
public void sendSMS()
{
String phoneNo = "+918110020302";
String message="Our Customer "+" has booked Cab no "+" using our application CabBooking and is cureently at location: "+address;
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, message, null, null);
q.setText(message +phoneNo);
Toast.makeText(getApplicationContext(), "SMS sent.", Toast.LENGTH_LONG).show();
}
catch (Exception e) {
Toast.makeText(getApplicationContext(), "SMS faild, please try again.", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
您的邮件看起来好像会超过单部分邮件的字符数限制,在这种情况下,您需要使用sendMultipartTextMessage()方法。 –