Domanda

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?

È stato utile?

Soluzione 2

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

Altri suggerimenti

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);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top