public class SmsSingleSender extends SmsBase
appid, appkey, httpclient| Constructor and Description |
|---|
SmsSingleSender(int appid,
String appkey) |
SmsSingleSender(int appid,
String appkey,
HTTPClient httpclient) |
| Modifier and Type | Method and Description |
|---|---|
SmsSingleSenderResult |
send(int type,
String nationCode,
String phoneNumber,
String msg,
String extend,
String ext)
普通单发
普通单发短信接口,明确指定内容,如果有多个签名,请在内容中以【】的方式添加到信息内容中,否则系统将使用默认签名
|
SmsSingleSenderResult |
sendWithParam(String nationCode,
String phoneNumber,
int templateId,
ArrayList<String> params,
String sign,
String extend,
String ext)
指定模板单发
|
SmsSingleSenderResult |
sendWithParam(String nationCode,
String phoneNumber,
int templateId,
String[] params,
String sign,
String extend,
String ext) |
handleErrorpublic SmsSingleSender(int appid,
String appkey)
public SmsSingleSender(int appid,
String appkey,
HTTPClient httpclient)
public SmsSingleSenderResult send(int type, String nationCode, String phoneNumber, String msg, String extend, String ext) throws HTTPException, org.json.JSONException, IOException
type - 短信类型,0 为普通短信,1 营销短信nationCode - 国家码,如 86 为中国phoneNumber - 不带国家码的手机号msg - 信息内容,必须与申请的模板格式一致,否则将返回错误extend - 扩展码,可填空ext - 服务端原样返回的参数,可填空HTTPException - http status exceptionorg.json.JSONException - json parse exceptionIOException - network problempublic SmsSingleSenderResult sendWithParam(String nationCode, String phoneNumber, int templateId, ArrayList<String> params, String sign, String extend, String ext) throws HTTPException, org.json.JSONException, IOException
nationCode - 国家码,如 86 为中国phoneNumber - 不带国家码的手机号templateId - 信息内容params - 模板参数列表,如模板 {1}...{2}...{3},那么需要带三个参数sign - 签名,如果填空,系统会使用默认签名extend - 扩展码,可填空ext - 服务端原样返回的参数,可填空HTTPException - http status exceptionorg.json.JSONException - json parse exceptionIOException - network problempublic SmsSingleSenderResult sendWithParam(String nationCode, String phoneNumber, int templateId, String[] params, String sign, String extend, String ext) throws HTTPException, org.json.JSONException, IOException
HTTPExceptionorg.json.JSONExceptionIOExceptionCopyright © 2018. All rights reserved.