title: BroadcastReceiver for multipart SMS
body: <p>I need to store sms to a sqlite db when I receive one. At this moment it works fine with sms (160 chars), but if I receive a multipart sms it truncate the sms at about 155 chars.</p>
  
  <p>This is my code:</p>
  
  <p><strong>SmsBR.java</strong></p>
  
  <pre><code>public class SmsBR extends BroadcastReceiver {
      private DBManager dbm;
          @Override
          public void onReceive(Context context, Intent intent) {
                      Bundle bundle = intent.getExtras();
                      if (bundle != null) {
                          Object[] pdus = (Object[])bundle.get("pdus");
                          final SmsMessage[] messages = new SmsMessage[pdus.length];
                          for (int i = 0; i &lt; pdus.length; i++) {
                              messages[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
                          }
                          if (messages.length &gt; 0) {
                              dbm=DBManager.getDBM(null);
                              dbm.insertSMS(messages[0]);
                                                     }}}}
  </code></pre>
  
  <p>DBManager is a singleton class that I wrote to simplify read/write operations and I'm sure that it has no problem with long texts!</p>