Android Open Source - piwik_android_sdk Piwik Database Helper






From Project

Back to project page piwik_android_sdk.

License

The source code is released under:

MIT License

If you think the Android project piwik_android_sdk 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.anupcowkur.piwiksdk;
/*from  w w w .  java2  s . co  m*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class PiwikDatabaseHelper extends SQLiteOpenHelper {

    public static final String EVT_TABLE = "event";
    public static final String EV_TABLE_COL_ID = "_id";
    public static final String EVT_TABLE_COL_USER_ID = "user_id";
    public static final String EVT_TABLE_COL_INFO = "info";
    public static final String EVT_TABLE_COL_TIMESTAMP = "timestamp";
    private static final String DATABASE_NAME = "piwik.db";
    private static final int DATABASE_VERSION = 1;
    private static final String CREATE_TABLE = "CREATE TABLE " + EVT_TABLE + "(" + EV_TABLE_COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + EVT_TABLE_COL_USER_ID + " TEXT, " + EVT_TABLE_COL_INFO + " TEXT, " + EVT_TABLE_COL_TIMESTAMP + " TEXT)";
    private static final String DROP_TABLE = "DROP TABLE IF EXISTS " + EVT_TABLE;
    private static PiwikDatabaseHelper piwikDatabaseHelper = null;

    public PiwikDatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    public static PiwikDatabaseHelper getInstance(Context context) {
        if (piwikDatabaseHelper == null) {
            piwikDatabaseHelper = new PiwikDatabaseHelper(context);
        }
        return piwikDatabaseHelper;
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL(CREATE_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i2) {
        sqLiteDatabase.execSQL(DROP_TABLE);
        onCreate(sqLiteDatabase);
    }
}




Java Source Code List

com.anupcowkur.piwiksample.CardFlipActivity.java
com.anupcowkur.piwiksample.LayoutChangesActivity.java
com.anupcowkur.piwiksample.MainActivity.java
com.anupcowkur.piwiksample.ScreenSlideActivity.java
com.anupcowkur.piwiksample.ScreenSlidePageFragment.java
com.anupcowkur.piwiksample.TouchHighlightImageButton.java
com.anupcowkur.piwiksample.ZoomActivity.java
com.anupcowkur.piwiksdk.AuthenticatorService.java
com.anupcowkur.piwiksdk.Authenticator.java
com.anupcowkur.piwiksdk.PiwikCallback.java
com.anupcowkur.piwiksdk.PiwikClient.java
com.anupcowkur.piwiksdk.PiwikContentProvider.java
com.anupcowkur.piwiksdk.PiwikDBItems.java
com.anupcowkur.piwiksdk.PiwikDatabaseHelper.java
com.anupcowkur.piwiksdk.PiwikSyncAdapter.java
com.anupcowkur.piwiksdk.PiwikSyncService.java
com.anupcowkur.piwiksdk.SharedPreferenceKeys.java
com.anupcowkur.piwiksdk.StoreDataTask.java