is there a limit to the number of numbers to send an SMS?

♀尐吖头ヾ 提交于 2019-12-23 01:36:55

问题


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.


回答1:


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



回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/19079151/is-there-a-limit-to-the-number-of-numbers-to-send-an-sms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!