SMS using Java
Using the mNatives Java solution you can send SMS messages from your Java code. This Java SMS Library is free to download, use and distribute.
Download jar Sample Scripts
import com.aclwireless.mnatives.mNativesHandler;
public class mNativesSMS {
public mNativesSMS() {
}
public String GetAvailableCredits(String UserId,String Password){
String response = new mNativesHandler().GetCredits(UserId,Password);
return response;
}
public String GetDLRStatus(String UserId,String Password,String MSISDN,String AppResponseId,String SubmitDate){
String response = new mNativesHandler().GetDLRStatus(UserId,Password,MSISDN,AppResponseId,SubmitDate);
return response;
}
public String SendMessage(String UserId,String Password,String Sender, String MSISDN,String MessageText){
String response = new mNativesHandler().SendMessage(UserId,Password,Sender,MSISDN,MessageText);
return response;
}
public static void main(String args[]){
String crResponse = new mNativesSMS().GetAvailableCredits("XXXX","XXXXX");
System.out.println("GET CREDITS RESPONSE :::"+crResponse);
String dlrResponse = new mNativesSMS().GetDLRStatus("XXXXXX","XXXXXX","XXXXXX","XXXXXX","XXXXXX");
System.out.println("GET DLR RESPONSE :::"+dlrResponse);
String sendMsgResponse = new mNativesSMS().SendMessage("XXXXXX","XXXXXX","XXXXXX","XXXXXX","XXXXXX");
System.out.println("SEND MESSAGE RESPONSE :::"+sendMsgResponse);
}
}
Parameters
| Parameter Name |
Parameter Description |
Parameter Value |
| USERID |
Account User Id |
User Id provided to the user for authentication |
| PASSWORD |
Account password |
Password provided |
| SENDER |
Account Sender |
Approved Sender Name |
| MOBILENO |
End User Number |
919650111640 (mobile to be separated by comma) |
| MESSAGE |
Message to be sent |
Hi This is a mNatives messaging |
| MESSAGETYPE |
For pushing promotional or Alert messages |
1 (For Pushing Alert Messages)
0 (For Promotional messages) |
| RESPONSEID |
Response Id |
Format is like UserId-152818-592 |
| DATE |
Date on which the response id is received. |
yyyymmdd(20100221) |
Errors
| Error Codes |
Error Description |
| -1 |
RESERVED |
| -2 |
MISSING USERID |
| -3 |
MISSING PASSWORD |
| -4 |
MISSING CONTENTID |
| -5 |
MISSING SENDER |
| -6 |
MISSING MOBILENUMBER |
| -7 |
MISSING MESSAGETEXT |
| -8 |
RESERVED |
| -9 |
MISSING SIURL |
| -10 |
AUTHENTICATION FAILED |
| -11 |
RESERVED |
| -12 |
MESSAGEID REPETED |
| -13 |
CONTENT NOT ALLOWDED |
| -14 |
RESERVED |
| -15 |
MALFORMED XML DATA RECEIVED |
| -16 |
INVALID DNDFLAG VALUE |
| -17 |
RESERVED |
| -18 |
INVALID CLI |
| -19 |
RESERVED |
| -20 |
RESERVED |
| -21 |
MOBILE NUMBER IN DND |
| -22 |
RESERVED |
| -100 |
CREDIT NOT AVAILABLE |
| -101 |
CREDIT NOT SUFFICIENT |
| -102 |
RESERVED |
| -103 |
RESERVED |
| -104 |
APP INTERNAL ERROR |
| -105 |
PRICE NOT FOUND |
| -333 |
PARAMETER MISSING (for credit availability & message Status enquiry) |
| -334 |
URL CALLING FAILED |