Java API for Kannel SMS/WAP gateway v 1.0.2 released

Hello all, we released version 1.0.2 of Java API for Kannel SMS/WAP gateway.

The latest version introduces prioritized WAP Push functionality and bulk WAP Push messaging.

You can download the new version here

An example use of the API is shown below :
 
 
 
 

public static void main(String[] args) {
 SMSManager smsManager = SMSManager.getInstance();
 // We can change the prefetch size of the background worker thread
 smsManager.setMessagesPrefetchSize(30);
 // We can change the send message rate
 smsManager.setMessagesSendRate(65);
 try {
  // Send SMS to a single destination
  smsManager.sendSMS("localhost", "13013", "foo", "bar", "sender_mobile_number", "receiver_mobile_number", "the_message");
  // Send SMS to a single destination with a specific priority and send rate
  smsManager.sendSMS("localhost", "13013", "foo", "bar", "sender_mobile_number", "receiver_mobile_number", "the_message", SMSManager.MESSAGE_PRIORITY_3);
  // Send SMS to multiple recipients
  List<String> recipientsGroupA = new ArrayList<String>();
  recipientsGroupA.add("receiver_mobile_number_1");
  recipientsGroupA.add("receiver_mobile_number_2");
  recipientsGroupA.add("receiver_mobile_number_3");
  recipientsGroupA.add("receiver_mobile_number_4");
  recipientsGroupA.add("receiver_mobile_number_5");
  smsManager.sendSMS("localhost", "13013", "foo", "bar", "sender_mobile_number", recipientsGroupA, "the_message");
  // Send SMS to multiple recipients with a specific priority and send rate
  List<String> recipientsGroupB = new ArrayList<String>();
  recipientsGroupB.add("receiver_mobile_number_1");
  recipientsGroupB.add("receiver_mobile_number_2");
  recipientsGroupB.add("receiver_mobile_number_3");
  recipientsGroupB.add("receiver_mobile_number_4");
  recipientsGroupB.add("receiver_mobile_number_5");
  smsManager.sendBulkSMS("localhost", "13013", "foo", "bar", "sender_mobile_number", recipientsGroupB, "the_message", SMSManager.MESSAGE_PRIORITY_7);
  // Send a WAP Push request to a single mobile recipient
  smsManager.sendWAPPush("localhost", "8181", "receiver_mobile_number", SMSManager.WAP_PUSH_RECEIVER_TYPE_MOBILE, "the_message", "http://localhost", 3);
  // Send a WAP Push request to a single destination with a specific priority and send rate
  smsManager.sendWAPPush("localhost", "8181", "receiver_mobile_number", SMSManager.WAP_PUSH_RECEIVER_TYPE_MOBILE, "the_message", "http://localhost", 3, SMSManager.MESSAGE_PRIORITY_8);
  // Send WAP Push request to multiple recipients with a specific priority and send rate
  List<String> recipientsGroupC = new ArrayList<String>();
  recipientsGroupC.add("receiver_mobile_number_1");
  recipientsGroupC.add("receiver_mobile_number_2");
  recipientsGroupC.add("receiver_mobile_number_3");
  recipientsGroupC.add("receiver_mobile_number_4");
  recipientsGroupC.add("receiver_mobile_number_5");
  smsManager.sendBulkWAPPush("localhost", "8181", recipientsGroupC, SMSManager.WAP_PUSH_RECEIVER_TYPE_MOBILE, "the_message", "http://localhost", 3, SMSManager.MESSAGE_PRIORITY_8);
 } catch (Exception ex) {
  ex.printStackTrace();
 }
 // Stops the background worker.
 // smsManager.stopSMSManagerWorker();
}

Best Regards

Justin

Related articles :
Exit mobile version