Send SMS On Mobile Using Java
ฝัง
- เผยแพร่เมื่อ 23 เม.ย. 2020
- In this video you will learn to send SMS to mobile using Java. We will use textlocal API to send text message on mobile using Java.
We will generate OTP ( One Time Password ) using SplitableRandom class provided by Java 8. That OTP we will send on Mobile so you will learn a real time scenario.
Generate OTP Using Java 8 - • Generate OTP (One Time...
NOTE - THIS IS ONLY FOR EDUCATION PURPOSE. FOLLOW YOUR LOCAL TELECOM RULES AND REGULATIONS SET BY YOUR GOVERNMENT.
Checkout below Courses Provided by me :-
Build REST API with Spring Boot and Spring Data JPA - bit.ly/2ZUT0JO
Learn MongoDB with Java and Spring Boot using Spring Data MongoDB and MongoRepository. - bit.ly/3a1pNkb
Learn RabbitMQ : Messaging with Java, Spring Boot And Spring MVC - bit.ly/2IRCn9U
Learn Java Messaging Service - Spring MVC, Spring Boot, ActiveMQ - bit.ly/2UdN7V4
Java Interview Preparation || 100+ Quality Questions Covered - bit.ly/33kzLdX
For more GO HERE - www.infybuzz.com
----------------------------------------------------------------------------------------
Code used in this video
public static void sendSMS (String otpStr) {
try {
String apiKey = "apiKey=" + "";
String message = "&message=" + URLEncoder.encode("Your OTP is " + otpStr,
"UTF-8");
String numbers = "&numbers=" + "";
String apiURL = "api.textlocal.in/send/?" + apiKey + message + numbers;
URL url = new URL(apiURL);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
BufferedReader reader = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
String line = "";
StringBuilder sb = new StringBuilder();
while ( (line = reader.readLine()) != null) {
sb.append(line).append("
");
}
System.out.println(sb.toString());
} catch (Exception e) {
e.printStackTrace();
}
} - วิทยาศาสตร์และเทคโนโลยี
you save my life!!!!!!. thnk my friend
Everything is okay for me. I really understood. Many thanks to you.
Thanks...
Nice explanation!!! 👍👍👍👍
Thanks...
It is working fine .thanks a lot
You are welcome
Bro how buy notifications API and implementation in java code. Kindly tell us, it's helpful for more people... Your teaching is Greatful bro..
Thank you 😊
you are welcome
Sir can we wanna put a +91 before the number of just put our number directly
Error code login details failed
After three messages
how add attatchments to this
This code is showing an error broo. Can u explain it clearly
its works only from 9am to 9pm why..... {"errors":[{"code":192,"message":"Messages can only be sent between 9am to 9pm as restricted by TRAI NCCP regulation"}],"status":"failure"}
I have already explained it @16:45
Hi Sir...Thanks for this
I am getting this error...could plz help understand and resolve this issue?
I am getting this below on STS console and not getting sms on mobile
Generated OTP=23XXX
{"errors":[{"code":5,"message":"No message content"}],"status":"failure"}
Have you provided otp as message content ?
Pls check description for complete code.
Bro same error mera hai but usme invalid login detail show kr rha hai
I am not getting any error, but no also receiving the sms.
Do you have do not disturb (DND) enabled in mobile ?
sir i didnt get any messages in my mobile,but system has shown generated otp
whatshould i do
Check if you are not enrolled in DND
Did the issue solve for you?
sir,it does not work, what can i do for it?
Any error you are getting ?
good sir. How we use as commercial i.e. Unlimited SMSs per month?
you have to purchase the licence for commercial use.
@@infybuzz sir can you share that information about how to purchase in this texttolocal site..
I got the message as a success. But I didn't get any otp message on my mobile. Help me out?
Can you try with other mobile number ?
I worked on fast2sms app. Then It worked!
will try to explore their API
It is sms free?
And server of sms api.local is free?
And must be regitration?
You need to register there and obtain API key. As trial you can send some messages for free.
Btw all these things explained in video
Sir please tell me the solution of this error..
Generated OTP = 56XXX
{"errors":[{"code":3,"message":"Invalid login details"}],"status":"failure"}
check api credentials. follow as per shown in video.
I followed the same Steps in my code but it is not working broo
Not working
i am getting error...... {"errors":[{"code":3,"message":"Invalid login details"}],"status":"failure"}..... can you please tell why?
Check if you are providing correct API key
@@infybuzz yes, i am using correct api even i generated one more api to check again but it didn't work..
Strange !!! It should work
Any solution?
Put @Responsebody annotation in your method
Why my apikey have = in end.
you don't need to worry about it. Use API Key whatever is provided to you.
Any solutions of below error??
{"errors":[{"code":80,"message":"Invalid template"}],"status":"failure"}
Can you try with the code provided in description ?
@@infybuzz yes sir.. But still i am getting that error
I'm getting the same error
@@infybuzz Hello Sir I am Also Getting Same Issue {"errors":[{"code":80,"message":"Invalid template"}],"status":"failure"}
@@infybuzz iam also getting same error bro
Insufficient credits error is coming
Insufficient credit error is coming
{"errors":[{"code":3,"message":"Invalid login details"}],"status":"failure"}
I'm facing this error. How to Resolve this Error??
have you obtained API key as shown in video ?
@@infybuzz yes , Today I tried, I got this error again. {"errors":[{"code":4,"message":"No recipients specified"}],"status":"failure"}
any Solution for this??
@@masoompasha3367 message itself is saying that No recipients specified. Have you provided mobile number on which you want to send SMS ?
Follow all steps shown in video.