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

  • Home
  • SEARCH
  • 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 6654205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:21:44+00:00 2026-05-26T01:21:44+00:00

In my app I need to send SMS, so I use the following code

  • 0

In my app I need to send SMS, so I use the following code

final String SMS_REQUEST_OK = "SMS_REQUEST_OK";
String m_sms_message = String.format("sample text");
String m_dest_number = "some number";

Intent SMSInfo = new Intent(SMS_REQUEST_OK);
SMSInfo.putExtra("msg", m_sms_message);
SMSInfo.putExtra("num", m_dest_number );
PendingIntent sentPI = PendingIntent.getBroadcast(m_context, 0,
                   SMSInfo, PendingIntent.FLAG_CANCEL_CURRENT);

m_context.registerReceiver(new BroadcastReceiver(){
    @Override
    public void onReceive(Context arg0, Intent arg1) {
        switch (getResultCode()){
            case Activity.RESULT_OK:
                Toast.makeText(m_context, String.format(
                    m_context.getResources().getString(R.string.sms_success), 
                    arg1.getExtras().getString("msg"),
                    arg1.getExtras().getString("num")), 
                    Toast.LENGTH_LONG).show();
                break;
            default:
                Toast.makeText(m_context, String.format(
                    m_context.getResources().getString(R.string.sms_error), 
                    arg1.getExtras().getString("msg"),
                    arg1.getExtras().getString("num")), 
                    Toast.LENGTH_LONG).show();
                break;
    }
}
}, new IntentFilter(SMS_REQUEST_OK));

SmsManager.getDefault().sendTextMessage(
    m_dest_number, 
    null, 
    m_sms_message, 
    sentPI, 
    null);

I expect it to try to send SMS one time, and then show Toast message with result of this operation. It works fine if SMS is sent successfully, however if it’s not it keeps retrying to send it, judging on lots of Toast messages (it occurs on HTC Desire (S), testing it on Samsung doesn’t get this behaviour – Toast with error is shown once).
So – is it how SmsManager should behave and how to avoid it (so that it try to send SMS only one time)?

edit I forgot to mention – it happens if getResultCode() returns 133404, haven’t tested it on other errors

edit2 According to this, 133404 is htc-specific error, which means temporary failure and device will retry automatically, untill, eventually, proper result code is received and broadcast is sent. However, no SmsManager-documented broadcast is received within resonable time. So the question remains – is there a way to stop this retry attempts?

  • 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-26T01:21:45+00:00Added an answer on May 26, 2026 at 1:21 am

    Just to summarize what I’ve found out: according to android documentation, expected behaviour of sendTextMessage() is only one attempt to send message, and broadcasting result afterwards. However, some HTC devices keep retrying to send message, broadcasting “temporary error” code after each attempt. So if app is only checking whether result code is “successfull” or not (as lots of sms applications on android market seem to do), it will mark message as unsent and stop listenning to it (which suits expected behaviour of sendTextMessage() function), which may lead to marking message unsent, when actually it was sent successfully in later attempt.

    What’s worse is that documented code might never be sent – so, if you get one of HTC “temporary codes” (133404 or 133179, there might be more however) message status is indetermined – it might be sent some time later, or might never be sent. So as it seems to me you can only determine message status by keeping listening for broadcast until you get proper result code (which may never be sent), or judging on delivery broadcast.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need my app to send a mail that becomes an SMS, in order
In my app I need to send a String[] titlephotos; to another Activity. I
I have an app where I need to be able to send SMS messages.
I need to send SMS messages from my app to users with status updates,
On a iPhone app, I need to send a jpg by mail with a
In my app I need to draw a widget contents onto Bitmap. The code(pseudo)
I am writing an app where I need to send all the Address Book
We are building a web app and will need to send emails on a
In my web app, during some change over the object, i need to send
I need to send a variable string as the message. I am using SKTPSMTPMesaage

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.