Question

in my app, I want to send a mass SMS to a bunch of numbers, and I want to know if there is a time threshold or a size limit to the list of recipients of an SMS.

all I saw in previous questions is code that no longer exists in the current builds of Android like references to SMSDispatcher and Settings constants that no longer exist in the current code.

Was it helpful?

Solution

after going through the Android sources for all the APIs supported by my app I cam up with the following code

private void setSmsDefaultLimitations(){

    int apiLevel = Build.VERSION.SDK_INT;
    String versionRelease = Build.VERSION.RELEASE;

    switch(apiLevel){
    case 9:
    case 10:
    case 11:
    case 12:
    case 13:
    case 14:
    case 15:
        sMaxAllowed = 100;
        sCheckPeriod = 3600000;
        break;
    case 16:
        sMaxAllowed = 30;
        sCheckPeriod = 1800000;
        break;
    case 17:
        sMaxAllowed = 30;
        if(versionRelease.contains("4.2.2")){
            sCheckPeriod = 60000;
        }else {
            sCheckPeriod = 1800000;
        }
        break;
    case 18:
        sMaxAllowed = 30;
        sCheckPeriod = 60000;
        break;
    default:
        sMaxAllowed = 30;
        sCheckPeriod = 1800000;
        break;
    }
    sMaxAllowed = sMaxAllowed - 2; //This is to give us a little buffer to be extra safe (like a condom ;)
    Log.d(TAG, "maxAllowed = "+sMaxAllowed+"; checkPeriod = "+(sCheckPeriod/60000) + " minutes");
}

OTHER TIPS

SMS sending limit was introduced not later than Gingerbread. As far as I know, and I investigated thoroughly, limits vary from API to API, and it is generally impossible to override these limits on non-rooted devices. If possible, those are rare exceptions. I think current minimum is 30 messages in 30 minutes, but this is subject to change. Google is the boss.

That being said, if your app is supposed to send messages from your device only or from controlled number of devices, you may get around this problem by rooting devices and then setting SMS_OUTGOING_CHECK_MAX_COUNT to a huge number (say 99999) in:

  • /data/data/com.android.providers.settings/databases/settings.db
    1. table secure
    2. table system
  • /data/data/com.google.android.gsf/databases/gservices.db
    1. table main

Also, if you're developing an app for a single API, you should Google its specific limit.

The amount of numbers you can send to a individual through SMS is 160. You can use sendMultiPartTextMessage() of SmsManager class method.

            EXAMPLES:

https://stackoverflow.com/a/3939791/254567

AND

https://stackoverflow.com/a/6590782/254567

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top