Android Open Source - AltSMS S M S Mediator






From Project

Back to project page AltSMS.

License

The source code is released under:

MIT License

If you think the Android project AltSMS listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ahmetkizilay.alt.sms;
/*from www. j a v a  2s .c  o m*/
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

public class SMSMediator {
  private final static Uri SMS_CONTENT_URI = Uri.parse("content://sms/");
  
  private Context context;
  
  public SMSMediator(Context context) {
    this.context = context;
  }
  
  public Cursor getAllSmsThreads() {
    final String[] PROJECTION = {"_id, count(*) as count", "thread_id", "person", "address", "body" };
    final String SELECTION = "thread_id IS NOT NULL) GROUP BY (thread_id";
    final String SORT = "date DESC limit 20";
    
    return context.getContentResolver().query(SMS_CONTENT_URI, PROJECTION, SELECTION, null, SORT);
  }
  
  public Cursor getAllSmsByThreadId(int threadId) {
    final String[] PROJECTION = {"_id", "person", "address", "body", "type", "date" };
    final String SELECTION = "thread_id = " + threadId;
    final String SORT = "date DESC";
    
    return context.getContentResolver().query(SMS_CONTENT_URI, PROJECTION, SELECTION, null, SORT);
  }
}




Java Source Code List

com.ahmetkizilay.alt.sms.ContactsUtils.java
com.ahmetkizilay.alt.sms.ListMessagesActivity.java
com.ahmetkizilay.alt.sms.ListThreadsActivity.java
com.ahmetkizilay.alt.sms.SMSMediator.java
com.ahmetkizilay.alt.sms.SMSMessagesCursorAdapter.java
com.ahmetkizilay.alt.sms.SMSThreadCursorAdapter.java