title: Android sending lots of SMS messages
body: <p>I have a app, which sends a lot of SMS messages to a central server.  Each user will probably send ~300 txts/day.  SMS messages are being used as a networking layer, because SMS is almost everywhere and mobile internet is not.  The app is intended for use in a lot of 3rd world countries where mobile internet is not ubiquitous.</p>
  
  <p>When I hit a limit of 100 messages, I get a prompt for each message sent.  The prompt says "A large number of SMS messages are being sent".  This is not ok for the user to get prompted each time to ask if the app can send a text message.  The user doesn't want to get 30 consecutive prompts.  </p>
  
  <p>I found this android source file with google.  It could be out of date, I can't tell.  It looks like there is a limit of 100 sms messages every 3600000ms(1 day) for each application.</p>
  
  <p><a href="http://www.netmite.com/android/mydroid/frameworks/base/telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java" rel="noreferrer">http://www.netmite.com/android/mydroid/frameworks/base/telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java</a></p>
  
  <pre><code>/** Default checking period for SMS sent without uesr permit */
  private static final int DEFAULT_SMS_CHECK_PERIOD = 3600000;
  
  /** Default number of SMS sent in checking period without uesr permit */
  private static final int DEFAULT_SMS_MAX_ALLOWED = 100;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>/**
   *  Implement the per-application based SMS control, which only allows
   *  a limit on the number of SMS/MMS messages an app can send in checking
   *  period.
   */
  private class SmsCounter {
      private int mCheckPeriod;
      private int mMaxAllowed;
      private HashMap&lt;String, ArrayList&lt;Long&gt;&gt; mSmsStamp;
  
      /**
       * Create SmsCounter
       * @param mMax is the number of SMS allowed without user permit
       * @param mPeriod is the checking period
       */
      SmsCounter(int mMax, int mPeriod) {
          mMaxAllowed = mMax;
          mCheckPeriod = mPeriod;
          mSmsStamp = new HashMap&lt;String, ArrayList&lt;Long&gt;&gt; ();
      }
  
      boolean check(String appName) {
          if (!mSmsStamp.containsKey(appName)) {
              mSmsStamp.put(appName, new ArrayList&lt;Long&gt;());
          }
  
          return isUnderLimit(mSmsStamp.get(appName));
      }
  
      private boolean isUnderLimit(ArrayList&lt;Long&gt; sent) {
          Long ct =  System.currentTimeMillis();
  
          Log.d(TAG, "SMS send size=" + sent.size() + "time=" + ct);
  
          while (sent.size() &gt; 0 &amp;&amp; (ct - sent.get(0)) &gt; mCheckPeriod ) {
                  sent.remove(0);
          }
  
          if (sent.size() &lt; mMaxAllowed) {
              sent.add(ct);
              return true;
          }
          return false;
      }
  }
  </code></pre>
  
  <p>Is this even the real android code?  It looks like it is in the package "com.android.internal.telephony.gsm", I can't find this package on the android website.</p>
  
  <p>How can I disable/modify this limit?  I've been googling for solutions, but I haven't found anything.</p>
  
  <hr>
  
  <p>So I was looking at the link that commonsware.com posted, and I found that the source had actually changed.  And so I might still have a shot.</p>
  
  <pre><code>    int check_period = Settings.Gservices.getInt(mResolver,
              Settings.Gservices.SMS_OUTGOING_CEHCK_INTERVAL_MS,
              DEFAULT_SMS_CHECK_PERIOD);
      int max_count = Settings.Gservices.getInt(mResolver,
              Settings.Gservices.SMS_OUTGOING_CEHCK_MAX_COUNT,
              DEFAULT_SMS_MAX_COUNT);
      mCounter = new SmsCounter(max_count, check_period);
  </code></pre>
  
  <p>This is getting checkPeriod and maxCount from a settings table.  But I don't seem to have access to the same table.  That source should be Android 1.1, which is the same I'm using.  When I try to import android.provider.Settings.Gservices, I get an error saying that the import can't be resolved.</p>
  
  <p>What is going on?</p>