Android Open Source - android-Notifier Message Provider






From Project

Back to project page android-Notifier.

License

The source code is released under:

GNU General Public License

If you think the Android project android-Notifier 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 rickflail.messaging.notifier;
//  w w  w  .jav  a  2  s. c o  m
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;

public class MessageProvider extends ContentProvider {
  
  public static final Uri CONTENT_URI = Uri.parse("content://rickflail.messaging.notifier/message" );
  private MessagesOpenHelper helper;

  public MessageProvider() {
    super();
  }

  @Override
  public int delete(Uri uri, String selection, String[] selectionArgs) {
    SQLiteDatabase db = helper.getWritableDatabase();
    return db.delete("messages", selection, selectionArgs);
  }

  @Override
  public String getType(Uri uri) {
    return null;
  }

  @Override
  public Uri insert(Uri uri, ContentValues values) {
    SQLiteDatabase db = helper.getWritableDatabase();
    db.insert("messages", null, values);
    return null;
  }

  @Override
  public boolean onCreate() {
    helper = new MessagesOpenHelper(getContext());
    return false;
  }

  @Override
  public Cursor query(Uri uri, String[] projection, String selection,
      String[] selectionArgs, String sortOrder) {
    SQLiteDatabase db = helper.getReadableDatabase();
    Cursor c = db.query("messages", projection, selection, selectionArgs, null, null, sortOrder);
    c.setNotificationUri(getContext().getContentResolver(), uri);
    return c;
  }

  @Override
  public int update(Uri uri, ContentValues values, String selection,
      String[] selectionArgs) {
    SQLiteDatabase db = helper.getWritableDatabase();
    return db.update("messages", values, selection, selectionArgs);
  }

}




Java Source Code List

rickflail.messaging.notifier.ClearReceiver.java
rickflail.messaging.notifier.GCMIntentService.java
rickflail.messaging.notifier.History.java
rickflail.messaging.notifier.MenuInflaterCustom.java
rickflail.messaging.notifier.MessageCursorAdapter.java
rickflail.messaging.notifier.MessageProvider.java
rickflail.messaging.notifier.MessagesOpenHelper.java
rickflail.messaging.notifier.Registration.java
rickflail.messaging.notifier.Settings.java
rickflail.messaging.notifier.UpdateReceiver.java