Android Open Source - Icinga-Mobile Session Provider

From Project

Back to project page Icinga-Mobile.


The source code is released under:

GNU General Public License

If you think the Android project Icinga-Mobile 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 mhst.dreamteam.IcingaService;
/*from w w  w . j a v  a 2  s.  c  o m*/
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import mhst.dreamteam.IcingaClient.GlobalConst;

 * @author MinhNN
public class SessionProvider extends ContentProvider {
    private SQLiteDatabase db;

    static final UriMatcher uriMatcher;
        uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
        uriMatcher.addURI(GlobalConst.CONTENT_SESSION_URI, "LastSession", 1);

    public boolean onCreate() {
        db = new SQLHelper(getContext()).getWritableDatabase();
        return (db != null);

    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        Cursor c = db.query("LastSession", projection, selection, selectionArgs, null, null, sortOrder);
        return c;

    public String getType(Uri uri) {
        return GlobalConst.CONTENT_SESSION_URI;

    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
        return db.update("LastSession", values, selection, selectionArgs);

    public Uri insert(Uri uri, ContentValues values)
        long rowID = db.insert("LastSession", "", values);
        if (rowID > 0) {
            return ContentUris.withAppendedId(Uri.parse(GlobalConst.CONTENT_SESSION_URI), rowID);
        return null;

    public int delete(Uri uri, String selection, String[] selectionArgs) {
        return db.delete("LastSession", selection, selectionArgs);


Java Source Code List