문제

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