Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6756417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:31:17+00:00 2026-05-26T13:31:17+00:00

I have an application which requires sending sms from one user to another.On receiving

  • 0

I have an application which requires sending sms from one user to another.On receiving this sms it sends back a reply sms.I have developed a code but the problem is it goes in aloop of sending again and again from one user to another.For example if user 1 sends some sms to user 2,then a sms is automatically sent to user 1 which in turn automatically sends sms to user 2 again and this goes again and again.How can I avoid that? I have to send the reply sms only once from user 2 to user 1 and then no return sms.Please help me with this code.

Here is my code:

http://pastebin.com/rt2Dd20k

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:31:18+00:00Added an answer on May 26, 2026 at 1:31 pm

    If you know the exact text that the automated SMS reply will contain, can’t you just put a condition around the block that sends the reply?

    String autoReplyText = "Whats up";
    boolean isAutoReply = msgs[i].getMessageBody().toString().equals(autoReplyText);
    
    if (!isAutoReply) {
        sms.sendTextMessage(str2, null, autoReplyText, pi, null);
    }
    

    edit: if the message is dynamic (which it seems that it needs to be, based on your comments) then you could ensure that all automatic replies start with a special string token which identifies them as an automatic reply. This way, if you receive a message that starts with your token, you know you don’t need to reply:

    String autoReplyToken = "[BANANA]";
    String autoReplyText = autoReplyToken + " dynamic message content";
    
    boolean isAutoReply = msgs[i].getMessageBody().toString().startsWith(autoReplyToken);
    
    if (!isAutoReply) {
        sms.sendTextMessage(str2, null, autoReplyText, pi, null);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a application which requires the user to input some values. From these
I have a Java application which requires certain software (one of them being Perl)
I have an application which requires plotting two locations on google map ? One
I have an application which requires data to be fetched from a received message
i have developed one windows (desktop) based application which sends pdf as an attachments.
I have an application which requires 3.5 (not SP1.) My understanding is that SP1
I have an application which requires authentication, but has some related services which can
I have written a PHP application which requires storage of millions of integers between
I am developing an application which requires to add Calendar event. I have written
I have an application which runs a tool that requires network connection. Now my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.