title: How to read failed messages using Telephony class?
body: <p>Using telephony class,<strong>Telephony.Sms.CONTENT_URI</strong> shows the content uri of the message database, but using this content uri, it won't loop through the failed messages, it only shows inbox outbox sent messages. How can i access through the failed messages?</p>
  
  <pre><code>public void getAllSms() {
      Uri messageUri = Uri.parse("content://sms/");
      ContentResolver cr = this.getContentResolver();
      Cursor c;
      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) {
          //Toast.makeText(this, "Sms Path : " + Telephony.Sms.CONTENT_URI, Toast.LENGTH_SHORT).show();
          c = cr.query(Telephony.Sms.CONTENT_URI, null, null, null, Telephony.Sms.DATE + " DESC");
      } else {
          c = cr.query(messageUri, null, null, null, "date DESC");
      }
  
      this.startManagingCursor(c);
      int totalSMS = 0;
      if (c != null) {
          totalSMS = c.getCount();
          if (c.moveToFirst()) {
              for (int j = 0; j &lt; totalSMS; j++) {
  
                  if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) {
                      String number = c.getString(c.getColumnIndexOrThrow(Telephony.Sms.ADDRESS));
                      String body = c.getString(c.getColumnIndexOrThrow(Telephony.Sms.BODY));
                      if (c.getString(c.getColumnIndexOrThrow(Telephony.Sms.TYPE)).contains("1")) {
                          //      activities.setIsoutgoing(false);
                      } else if (c.getString(c.getColumnIndexOrThrow(Telephony.Sms.TYPE)).contains("5")) {
                          Log.d("Not inbox type", "Failed");
                      } else if (c.getString(c.getColumnIndexOrThrow(Telephony.Sms.TYPE)).contains("2")) {
  
                          Log.d("Not inbox type", "OUT");
                          // activities.setIsoutgoing(true);
                          //      activities.setActivitystatus("completed");
                      }
                  c.moveToNext();
              }
          }
      } else {
          //   Toast.makeText(this, "No message to show!", Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>