Here is my code

try {
  twilioConnect();
  com.twilio.sdk.resource.instance.Account account = client.getAccount();
  SmsFactory smsFactory = account.getSmsFactory();
  Map<String, String> smsParams = new HashMap<String, String>();
  smsParams.put("To", "+" + phone);
  smsParams.put("From", TWILIO_SERVER_PHONE_NUMBER); 
  smsParams.put("Body", mymessage);
  Sms sms = smsFactory.create(smsParams);
} catch (TwilioRestException e) {
  e.printStackTrace();
}

Can my code send the up to 1600 characters mentioned on Twilio or is there a different code for that? If the method is different, will someone please present something as clear as my snippet?

有帮助吗?

解决方案 2

You should be able to send up to 1,600 characters, but beware that it may send as multiple messages of 160 characters.

其他提示

You cannot use that API. Instead, switch to:

Account account = client.getAccount();
MessageFactory factory = account.getMessageFactory();

List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("From", from));
params.add(new BasicNameValuePair("To", to)); 
params.add(new BasicNameValuePair("Body", body));    
params.add(new BasicNameValuePair("StatusCallback", statusCallback));

Message msg = factory.create(params);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top