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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:11:23+00:00 2026-06-16T19:11:23+00:00

I recently ran into a little trouble with sending SMSes as sendTextMessage can only

  • 0

I recently ran into a little trouble with sending SMSes as sendTextMessage can only send SMSes of 160 characters or lower. I, however, wish to send a long text wishing to prompt another user to input information.

Here’s my code:

//sends a SMS message to another device
private void sendSMS(String phoneNo, String text)
{     

    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);

    //when the SMS has been sent
    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));

    //when the SMS has been delivered 
    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));



    displaySent(text, phoneNo);     

    SmsManager sms = SmsManager.getDefault();
    ArrayList<String> parts = sms.divideMessage(text);
    sms.sendMultipartTextMessage(phoneNo, null, parts, sentPI, deliveredPI);***********

    //SmsManager sms = SmsManager.getDefault();
    //sms.sendTextMessage(phoneNo, null, text, sentPI, deliveredPI);



}

At the line marked with the Asterixs, the error “The method sendMultipartTextMessage(String, String, ArrayList, ArrayList, ArrayList) in the type SmsManager is not applicable for the arguments (String, null, ArrayList, PendingIntent, PendingIntent)” appears. I hope this will help.

Any help with this would be much appreciated.

On a side note, i am wondering why can’t all methods to send text messages be simply one that can break up all messages on its own already? Why the need to have sendTextMessage and sendMultipartTextMessage when i assume, that sendMultipartMessage can do the job of sendTextMessage. Any suggestions to why this may be would also be greatly appreciated.

  • 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-06-16T19:11:24+00:00Added an answer on June 16, 2026 at 7:11 pm

    Change your code as for sending message using sendMultipartTextMessage:

    SmsManager sms = SmsManager.getDefault();
    ArrayList<String> parts = sms.divideMessage(text);
    
    
    ArrayList<PendingIntent> sentPIarr = new ArrayList<PendingIntent>();
    ArrayList<PendingIntent> deliveredPIarr = new ArrayList<PendingIntent>();
    
    for (int i = 0; i < parts.size(); i++) {
    sentPIarr.add(PendingIntent.getBroadcast(this, 0,new Intent(SENT), 0));
    deliveredPIarr.add(PendingIntent.getBroadcast(this, 0,new Intent(DELIVERED), 0));
    }
    
    sms.sendMultipartTextMessage(phoneNo, null, parts, sentPIarr, deliveredPIarr); 
    

    because sendMultipartTextMessage method take ArrayList as fourth and fifth param of pendingIntents

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

Sidebar

Related Questions

I've recently ran into a little for when an object fails to save due
I recently ran into the problem that i can't work with a table that
I recently ran into an issue on my development box. I can run my
I recently ran into a bug in my code when using boost::bind . From
I recently ran into an error when I tried to change the column name
I recently ran into an issue where a query was causing a full table
I recently ran into a familiar javascript/jQuery timing bug and spent too long debugging
A problem I recently ran into was that when trying to update a field
I'm currently playing around with tipfy on Google's Appengine and just recently ran into
My application requires the .NET Framework version 3.5. I recently ran into a customer

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.