Easy way to integrate MSG91 API's to your Android App.
MSG91, a bulk SMS service provider offers transactional and promotional bulk SMS solutions to enterprises via powerful & robust bulk SMS gateway internationally.
Add this in your build.gradle
dependencies {
compile 'com.katepratik.msg91-android-sdk:library:0.1'
}
Create MSG91 object with you Authentication Key
Normal Use:
MSG91 msg91 = new MSG91("your_auth_key");
Debugging Use:
MSG91 msg91Debug = new MSG91("your_auth_key", true);
NOTE : These methods return String response which is received from the REST API's of MSG91
- To validate your auth key
String validate = msg91Debug.validate();
- To check SMS balance
// Promotional SMS Route is 1
String balancePromotional = msg91.getBalance("1");
// Transactional SMS Route is 4
String balanceTransactional = msg91.getBalance("4");
- To change password
String change = msg91.changePassword("old_password", "new_password");
- To send SMS to SINGLE mobile number
msg91.composeMessage("ABCDEF", "This Sample message body that will be sent with sender id : ABCDEF to single mobile number");
msg91.to("9876543210");
String sendStatus = msg91.send();
- To send SMS to MULTIPLE mobile number
ArrayList<String> mobileNumbers =new ArrayList<>();
mobileNumbers.add("9876543210");
mobileNumbers.add("9876543211");
mobileNumbers.add("1234567890");
mobileNumbers.add("1234567890");
msg91.composeMessage("ABCDEF", "Your Message");
msg91.to(mobileNumbers);
String sendStatus = msg91.send();
- To send Schedule SMS
msg91.composeMessage("ABCDEF", "Your Message");
msg91.to("9876543210";
msg91.setSchedule("2015-12-27 12:38:38");
String sendStatus = msg91.send();
- To send Flash SMS
msg91.composeMessage("ABCDEF", "Your Message");
msg91.to("9876543210");
msg91.flash(true);
String sendStatus = msg91.send();
- To send Unicode SMS
msg91.composeMessage("ABCDEF", "Your Message");
msg91.to("9876543210");
msg91.unicode(true);
String sendStatus = msg91.send();
- To send Promotional SMS
msg91.composeMessage("ABCDEF", "Your Message");
msg91.to("9876543210");
msg91.setRoute("1");
String sendStatus = msg91.send();
- To send Transactional SMS
msg91.composeMessage("ABCDEF", "Your Message");
msg91.to("9876543210");
msg91.setRoute("4");
String sendStatus = msg91.send();
- To set Campaign
msg91.composeMessage("ABCDEF", "Your Message");
msg91.to("9876543210");
msg91.setCampaign("Campaign");
String sendStatus = msg91.send();
- To set Country Code
msg91.composeMessage("ABCDEF", "Your Message");
msg91.to("9876543210");
msg91.setCountryCode("91");
String sendStatus = msg91.send();
SDK Developer : Pratik Kate | REST API's : MSG91 Team
Copyright 2015 Pratik Kate
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.