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();
    }
    }
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 64

  • @Chguhjgh
    @Chguhjgh 4 ปีที่แล้ว +1

    you save my life!!!!!!. thnk my friend

  • @moha12792
    @moha12792 3 ปีที่แล้ว

    Everything is okay for me. I really understood. Many thanks to you.

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว

      Thanks...

  • @faseehahmad3513
    @faseehahmad3513 4 ปีที่แล้ว

    Nice explanation!!! 👍👍👍👍

    • @infybuzz
      @infybuzz  4 ปีที่แล้ว

      Thanks...

  • @loveyourself9354
    @loveyourself9354 4 ปีที่แล้ว

    It is working fine .thanks a lot

    • @infybuzz
      @infybuzz  4 ปีที่แล้ว

      You are welcome

  • @Nantha-kumar
    @Nantha-kumar ปีที่แล้ว +1

    Bro how buy notifications API and implementation in java code. Kindly tell us, it's helpful for more people... Your teaching is Greatful bro..

  • @swatiraykar2563
    @swatiraykar2563 ปีที่แล้ว

    Thank you 😊

    • @infybuzz
      @infybuzz  ปีที่แล้ว

      you are welcome

  • @manishtambe8078
    @manishtambe8078 4 ปีที่แล้ว

    Sir can we wanna put a +91 before the number of just put our number directly

  • @googledoodle2024
    @googledoodle2024 4 ปีที่แล้ว

    Error code login details failed
    After three messages

  • @jaymistry5521
    @jaymistry5521 3 ปีที่แล้ว

    how add attatchments to this

  • @meenaganaveen6485
    @meenaganaveen6485 9 หลายเดือนก่อน

    This code is showing an error broo. Can u explain it clearly

  • @sandeepkumarrayala6738
    @sandeepkumarrayala6738 4 ปีที่แล้ว

    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"}

    • @infybuzz
      @infybuzz  4 ปีที่แล้ว

      I have already explained it @16:45

  • @kaushlendrakaushal8729
    @kaushlendrakaushal8729 3 ปีที่แล้ว

    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"}

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว

      Have you provided otp as message content ?
      Pls check description for complete code.

    • @Trade-Scout
      @Trade-Scout ปีที่แล้ว

      Bro same error mera hai but usme invalid login detail show kr rha hai

  • @kensinaon
    @kensinaon 4 ปีที่แล้ว

    I am not getting any error, but no also receiving the sms.

    • @infybuzz
      @infybuzz  4 ปีที่แล้ว

      Do you have do not disturb (DND) enabled in mobile ?

  • @balasaraswathi2433
    @balasaraswathi2433 3 ปีที่แล้ว

    sir i didnt get any messages in my mobile,but system has shown generated otp
    whatshould i do

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว

      Check if you are not enrolled in DND

    • @venkykadiri2403
      @venkykadiri2403 3 ปีที่แล้ว

      Did the issue solve for you?

  • @kartikeygupta8786
    @kartikeygupta8786 4 ปีที่แล้ว

    sir,it does not work, what can i do for it?

    • @infybuzz
      @infybuzz  4 ปีที่แล้ว

      Any error you are getting ?

  • @adigoppulasreenu9092
    @adigoppulasreenu9092 3 หลายเดือนก่อน

    good sir. How we use as commercial i.e. Unlimited SMSs per month?

    • @infybuzz
      @infybuzz  3 หลายเดือนก่อน

      you have to purchase the licence for commercial use.

    • @adigoppulasreenu9092
      @adigoppulasreenu9092 3 หลายเดือนก่อน

      @@infybuzz sir can you share that information about how to purchase in this texttolocal site..

  • @venkykadiri2403
    @venkykadiri2403 3 ปีที่แล้ว

    I got the message as a success. But I didn't get any otp message on my mobile. Help me out?

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว +1

      Can you try with other mobile number ?

    • @venkykadiri2403
      @venkykadiri2403 3 ปีที่แล้ว +1

      I worked on fast2sms app. Then It worked!

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว +1

      will try to explore their API

  • @alimuthohari8507
    @alimuthohari8507 3 ปีที่แล้ว

    It is sms free?
    And server of sms api.local is free?

    • @alimuthohari8507
      @alimuthohari8507 3 ปีที่แล้ว

      And must be regitration?

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว

      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

  • @Trade-Scout
    @Trade-Scout ปีที่แล้ว

    Sir please tell me the solution of this error..
    Generated OTP = 56XXX
    {"errors":[{"code":3,"message":"Invalid login details"}],"status":"failure"}

    • @infybuzz
      @infybuzz  ปีที่แล้ว

      check api credentials. follow as per shown in video.

    • @meenaganaveen6485
      @meenaganaveen6485 9 หลายเดือนก่อน

      I followed the same Steps in my code but it is not working broo

  • @Trade-Scout
    @Trade-Scout ปีที่แล้ว

    Not working

  • @shobitaarora2755
    @shobitaarora2755 3 ปีที่แล้ว

    i am getting error...... {"errors":[{"code":3,"message":"Invalid login details"}],"status":"failure"}..... can you please tell why?

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว

      Check if you are providing correct API key

    • @shobitaarora2755
      @shobitaarora2755 3 ปีที่แล้ว

      @@infybuzz yes, i am using correct api even i generated one more api to check again but it didn't work..

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว

      Strange !!! It should work

    • @shobitaarora2755
      @shobitaarora2755 3 ปีที่แล้ว

      Any solution?

    • @ashokkumar-iq7yq
      @ashokkumar-iq7yq 3 ปีที่แล้ว

      Put @Responsebody annotation in your method

  • @gunabharathig1273
    @gunabharathig1273 2 ปีที่แล้ว

    Why my apikey have = in end.

    • @infybuzz
      @infybuzz  2 ปีที่แล้ว

      you don't need to worry about it. Use API Key whatever is provided to you.

  • @visualart8609
    @visualart8609 3 ปีที่แล้ว

    Any solutions of below error??
    {"errors":[{"code":80,"message":"Invalid template"}],"status":"failure"}

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว

      Can you try with the code provided in description ?

    • @visualart8609
      @visualart8609 3 ปีที่แล้ว

      @@infybuzz yes sir.. But still i am getting that error

    • @rohitkolape5358
      @rohitkolape5358 2 ปีที่แล้ว

      I'm getting the same error

    • @ganeshnawle9289
      @ganeshnawle9289 2 ปีที่แล้ว

      @@infybuzz Hello Sir I am Also Getting Same Issue {"errors":[{"code":80,"message":"Invalid template"}],"status":"failure"}

    • @devendranshankar4858
      @devendranshankar4858 2 ปีที่แล้ว

      @@infybuzz iam also getting same error bro

  • @Brokenheart-gh7cr
    @Brokenheart-gh7cr 4 ปีที่แล้ว

    Insufficient credits error is coming

  • @Brokenheart-gh7cr
    @Brokenheart-gh7cr 4 ปีที่แล้ว

    Insufficient credit error is coming

  • @masoompasha7368
    @masoompasha7368 3 ปีที่แล้ว

    {"errors":[{"code":3,"message":"Invalid login details"}],"status":"failure"}
    I'm facing this error. How to Resolve this Error??

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว

      have you obtained API key as shown in video ?

    • @masoompasha3367
      @masoompasha3367 3 ปีที่แล้ว

      @@infybuzz yes , Today I tried, I got this error again. {"errors":[{"code":4,"message":"No recipients specified"}],"status":"failure"}

    • @masoompasha3367
      @masoompasha3367 3 ปีที่แล้ว

      any Solution for this??

    • @infybuzz
      @infybuzz  3 ปีที่แล้ว

      @@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.