Showing posts with label unified sma api. Show all posts

Unified SMS Sending API for Android

Unified SMS Sending API for Android

This is a common interface for sms services that provide the possibility for programmatically send SMS.

Support SMS Services

Nexmo
Twilio
Twizo
Msg91

How to Download

You can download the library using Gradle or Maven

Gradle

compile 'com.ajts.library.unifiedsms:unifiedsmslibrary:1.0.0'

Maven

<dependency>
  <groupId>com.ajts.library.unifiedsms</groupId>
  <artifactId>unifiedsmslibrary</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

How to Use

SMS API Initialization

SMS sms = new SMS();

Nexmo SMS Service

Nexmo nexmo = new Nexmo("[Nexmo API Key]", "[Nexmo API Secret]");
sms.sendSMS(nexmo, "[Sender Name]", "[To number with country code]", "[Text Message]", new SMSCallback() {
    @Override
    public void onResponse(Call call, Response response) {
        Log.v("nexmo", response.toString());
    }

    @Override
    public void onFailure(Call call, Exception e) {

    }
});

Twilio SMS Service

Twilio twilio = new Twilio("[Twilio Account SID]", "[Twilio Auth Token]");
sms.sendSMS(twilio, "[Sender Name]", "[To number with country code]", "[Text Message]", new SMSCallback() {
    @Override
    public void onResponse(Call call, Response response) {
        Log.v("twilio", response.toString());
    }

    @Override
    public void onFailure(Call call, Exception e) {

    }
});

Twizo SMS Service

Twizo twizo = new Twizo("[Twizo Key]");
sms.sendSMS(twizo, "[Sender Name]", "[To number with country code]", "[Text Message]", new SMSCallback() {
    @Override
    public void onResponse(Call call, Response response) {
        Log.v("twizo", response.toString());
    }

    @Override
    public void onFailure(Call call, Exception e) {

    }
});

Msg91 SMS Service

Msg91 msg91 = new Msg91("[Msg91-Auth-Key]");
sms.sendSMS(msg91, "[Sender Name]", "[To number]", "[Text Message]", "[Country Code]", new SMSCallback() {
    @Override
    public void onResponse(Call call, Response response) {
        Log.v("msg91", response.toString());
    }

    @Override
    public void onFailure(Call call, Exception e) {
        Log.v("msg91", e.toString());
    }
});

Issue Tracker

Note:

If you find any issues regarding this API, you can make issue in Github with SMS API Issues Label