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 6757225
In Process

The Archive Base Latest Questions

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

I have a problem, not that major problem but since i implemented sendMultipartTextMessage on

  • 0

I have a problem, not that major problem but since i implemented sendMultipartTextMessage on my codes the toast of “SMS Sent” or any other toast wont show up. I dunno if the sms is successfully sent or not. What should I do? Here’s the code:

private void sendSMS(String phoneNo, String message, boolean split)
    {      
        String SENT = "SMS_SENT";
        String DELIVERED = "SMS_DELIVERED";

        PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,
            new Intent(SENT), 0);

        PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,
            new Intent(DELIVERED), 0);

        SmsManager sms = SmsManager.getDefault();
        if (!split) {
            Log.d("SMSTest", "Sending single message: " + message);
        } else {
            Log.d("SMSTest", "Sending '" + message + "' in multiple parts.");
            ArrayList<String> parts = sms.divideMessage(message);
            Log.d("SMSTest", parts.size() + " parts:");
            for (String string : parts) {
                Log.d("SMSTest", string);
            }    
    ArrayList<PendingIntent> sentList = new ArrayList<PendingIntent>();
                    sentList.add(sentPI);
                    ArrayList<PendingIntent> deliveredList = new ArrayList<PendingIntent>();
                    deliveredList.add(deliveredPI);
                    sms.sendMultipartTextMessage(phoneNo, null, parts, sentList,
                            deliveredList);

                registerReceiver(new BroadcastReceiver(){
                    @Override
                    public void onReceive(Context arg0, Intent arg1) {
                        switch (getResultCode())
                        {
                            case Activity.RESULT_OK:
                                Toast.makeText(getBaseContext(), "SMS sent", 
                                        Toast.LENGTH_SHORT).show();
                                break;
                            case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                                Toast.makeText(getBaseContext(), "Generic failure", 
                                        Toast.LENGTH_SHORT).show();
                                break;
                            case SmsManager.RESULT_ERROR_NO_SERVICE:
                                Toast.makeText(getBaseContext(), "No service", 
                                        Toast.LENGTH_SHORT).show();
                                break;
                            case SmsManager.RESULT_ERROR_NULL_PDU:
                                Toast.makeText(getBaseContext(), "Null PDU", 
                                        Toast.LENGTH_SHORT).show();
                                break;
                            case SmsManager.RESULT_ERROR_RADIO_OFF:
                                Toast.makeText(getBaseContext(), "Radio off", 
                                        Toast.LENGTH_SHORT).show();
                                break;
                        }
                    }
                }, new IntentFilter(SENT));

                registerReceiver(new BroadcastReceiver(){
                    @Override
                    public void onReceive(Context arg0, Intent arg1) {
                        switch (getResultCode())
                        {
                            case Activity.RESULT_OK:
                                Toast.makeText(getBaseContext(), "SMS delivered", 
                                        Toast.LENGTH_SHORT).show();
                                break;
                            case Activity.RESULT_CANCELED:
                                Toast.makeText(getBaseContext(), "SMS not delivered", 
                                        Toast.LENGTH_SHORT).show();
                                break;                      
                        }
                    }
                }, new IntentFilter(DELIVERED));   
                }
            }
        }
  • 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:37:16+00:00Added an answer on May 26, 2026 at 1:37 pm

    You should never implement a switch without default case. Make one and display the value of getResultCode(), than you might see at least what is returned. This should help you investigate the behavior further.

    Sample:

    switch (getResultCode()) {
        case Activity.RESULT_OK:
            Toast.makeText(getBaseContext(), "SMS delivered", Toast.LENGTH_SHORT).show();
            break;
        case Activity.RESULT_CANCELED:
            Toast.makeText(getBaseContext(), "SMS not delivered", Toast.LENGTH_SHORT).show();
            break;
        default:
            Toast.makeText(getBaseContext(), "Default... " + getResultCode(), Toast.LENGTH_SHORT).show();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem that someone introduced a bug but I do not know
I have a problem that I have not faced before: It seems that the
I have the odd problem that I am not able to open the properties
I have encountered a problem that I have not come accross yet when setting
I have a strange problem that I could not solve. When I try to
Here is a hum-dinger of a problem that I have not found an answer
I do not have problem as such but I am quite new to Ruby.
The problem is not about randomness itself (we have rand), but in cryptographically secure
If I ever have a problem that is not showing up as a warning,
I have looked everywhere but have not found a problem similar to this. I

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.