Java 在sms中将文本设置为超链接
各位。 我有一条带有URL的短信: 比如:“你想买吗?”我想把我的url地址变成超链接:“你想买它吗?”?“它”将在哪里链接 我怎么能做到 我的短信发送方法Java 在sms中将文本设置为超链接,java,Java,各位。 我有一条带有URL的短信: 比如:“你想买吗?”我想把我的url地址变成超链接:“你想买它吗?”?“它”将在哪里链接 我怎么能做到 我的短信发送方法 public Future<Boolean> sendSmsNotification(String to, String body) { try { logger.info("Trying send SMS"); MessageFactory messageFactory = twilio
public Future<Boolean> sendSmsNotification(String to, String body) {
try {
logger.info("Trying send SMS");
MessageFactory messageFactory = twilioRestClient.getAccount().getMessageFactory();
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("To", to));
params.add(new BasicNameValuePair("From", smsFromNumber));
params.add(new BasicNameValuePair("Body", body));
messageFactory.create(params);
logger.info("SMS to "+to+" was send");
} catch (Exception e) {
logger.error("Error while sending SMS ",e);
return new AsyncResult<Boolean>(false);
}
return new AsyncResult<Boolean>(true);
}
公共未来发送消息通知(字符串到,字符串正文){
试一试{
logger.info(“尝试发送短信”);
MessageFactory MessageFactory=twilioRestClient.getAccount().getMessageFactory();
List params=new ArrayList();
参数添加(新的BasicNameValuePair(“To”,To));
参数add(新的BasicNameValuePair(“From”,smsFromNumber));
参数添加(新的BasicNameValuePair(“主体”,主体));
messageFactory.create(参数);
logger.info(“发送短信至“+至+”);
}捕获(例外e){
logger.error(“发送短信时出错”,e);
返回新的异步结果(false);
}
返回新的异步结果(true);
}
身体是弦型的。我认为你做不到;这取决于收信人的电话来实现这种魔力。@chrylis是正确的。短信是纯文本的。如果URL格式正确,一些智能手机会自动将URL转换为可点击链接。@WebCode.ie thanx以获取答案。我可以使用彩信完成该任务吗?