I have an android application which need to be updated at code level and upgrade features. long story short the app useas a sqlite DB to store data but now it needs to store data in the cloud. is there an easy way to sync the sqlite stored data to firebase or remotemysql.com? (preferably firebase)
I have never used sqlite
class FoodDBOpenHelper extends SQLiteOpenHelper {
//specify the database local file name
private static final String DATABASE_NAME = "foods.db";
private static final int DATABASE_VERSION = 3;
public FoodDBOpenHelper(Context context) {
super(context, DATABASE_NAME, null , DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
final String SQL_CREATE_TUTORIALS_TABLE = "CREATE TABLE " +
FoodContract.FoodEntry.TABLE_NAME + " (" +
FoodContract.FoodEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
FoodContract.FoodEntry.COLUMN_FOOD_NAME+ " TEXT NOT NULL," +
FoodContract.FoodEntry.COLUMN_FOOD_UNIT + " INTEGER NOT NULL," +
FoodContract.FoodEntry.COLUMN_FOOD_QUANTITY + " REAL NOT NULL," +
FoodContract.FoodEntry.COLUMN_FOOD_CATEGORY + " INTEGER NOT NULL," +
FoodContract.FoodEntry.COLUMN_FOOD_REGISTERED_TIMESTAMP + " TEXT NOT NULL," +
FoodContract.FoodEntry.COLUMN_FOOD_EXPIRE_DATE + " TEXT NOT NULL," +
FoodContract.FoodEntry.COLUMN_SECTION_ID + " INTEGER NOT NULL" +
");";
sqLiteDatabase.execSQL(SQL_CREATE_TUTORIALS_TABLE);
}
instead of rewrite the actual code I want to query data on the db acomodate into a json array and push into firebase with a button to "sync" data between local.db and firebase db