I am developing an online store application. When user purchases, I want to send SMS to him (like most of the eCommerce website do ex flipkart or eBay when we purchase then they send SMS ). to do this I have to use SMS gateway or android Sms Manager? which are the available api for this?
I tired following code but I dont think most of the site use this ?
String message = "your message";
String number = "recipient number";
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(number, null, message, null, null);
Do I have to use smtp or http?
Edi- got few nice gateways for sms ie nexmo ,twilio
3
Answers
This is the code for sending SMS in android:
Yes. Your question is server related. eCommerce sites buy sms sending services. For example http://www.mysmsindia.com/service-price-list.html. If you buy such a plan you will get api to access and send SMS.
If you want to send sms free. You can try using sms sending sites such as http://www.way2sms.com. However such sites do not provide any API to send messages. You need to create an account on way2sms.com. Through code you need to login using HTTP requests and use HTTP Post Request call to server to trigger SMS sending operation. This requires you to study what post parameters are accepted, what coockies are set for successful SMS sending. You can do this by using Firebug tool in mozilla firefox. However this way you can not send bulk SMS. Also you have many limitations since you are not using premium SMS sending service and you are just using the site via your java/php code instead of web browser. For example, in way2sms.com you can send a SMS to 10 person at a time, You have 100SMS limit per day. All such limitations will be there.
Coming to your question and need. You need to buy out the service or create a module which sends messages using free SMS services. Then you need to use this API or module in your server side code to trigger SMS sending operation.
You will have to send the sms from the sever side. SMS manager of android will help you to send sms from the android mobile device. You would not want to use this as it will be sent from the device’s phone using his number and his carrier may cost him.
For sending free sms you may use any of the free SMS api that are available. Mashape provides a good list of free api’s available. Here is the link.