2

After looking on th e website, I was not able to find any solution to this problem. Let me explain a bit more :

I'm trying to send (programmatically) from an App a multipart SMS. It's actually working on my device (Nexus 4) but I tried it on a Galaxy Note, which convert any long-sized SMS to MMS and the app only send short SMS. Any clue about that? Does the Samsung API or something prevent the sendMultipartTextMessage() method from being executed?

In my sending function, I have Log debug, which is shown on screen, so the call to this function is well done..

Thanks for any help!

Here is the code I use :

public static void sendSMS(final Activity a, String phoneNumber, String message)
{        
    try {
        SmsManager sms = SmsManager.getDefault();
        ArrayList<String> parts = sms.divideMessage(message); 

        ArrayList<PendingIntent> sendIntents = new ArrayList<PendingIntent>(parts.size());
        for (int i = 0; i < sendIntents.size(); i++)
        {
            Intent sendInt = new Intent("");
            PendingIntent sendResult = PendingIntent.getBroadcast(a.getApplicationContext(), 0, sendInt, PendingIntent.FLAG_ONE_SHOT);
            sendIntents.add(sendResult);
        }

        sms.sendMultipartTextMessage(phoneNumber, null, parts, null, null);
        ContentValues values = new ContentValues();

        values.put("address", phoneNumber);
        values.put("body", message); 

        a.getApplicationContext().getContentResolver().insert(Uri.parse("content://sms/sent"), values);
    } catch(Exception e) {
        e.printStackTrace(System.out);
    }
}

1 Answers1

1
    public void sendSMS(String phoneNumber, String longMessage) {
    try {

        SmsManager sms = SmsManager.getDefault();
        ArrayList<String> parts = sms.divideMessage(longMessage);
        sms.sendMultipartTextMessage(phoneNumber, null, parts, null, null);

    } catch (Exception ex) {
        ex.printStackTrace();
    }
   }

add this permission also :

<uses-permission android:name="android.permission.SEND_SMS"/>

above code works for on Samsung Galaxy Note 2 (Android 4.1.1), Micromax HD Canvas (Android 4.1.1) , Samsung Galaxy S3 (Android 4.1.1), HTC One X (Android 4.0).

So this function is not block for me on samsung phones.

VISHAL VIRADIA
  • 1,388
  • 1
  • 15
  • 34