有没有一种简单的方法可以将 sqlite 数据库同步到 firebase json?

is there an easy way to sync a sqlite db to firebase json?

我有一个 android 应用程序需要在代码级别更新和升级功能。长话短说,该应用程序用作 sqlite 数据库来存储数据,但现在它需要将数据存储在云中。有没有一种简单的方法可以将 sqlite 存储的数据同步到 firebase 或 remotemysql.com? (最好是 Firebase)

我没用过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);
}

我不想重写实际代码,而是想将 db acomodate 上的数据查询到 json 数组中,然后使用按钮将 "sync" 数据推入 firebase local.db 和 firebase 之间分贝

is there an easy way to sync the sqlite stored data to firebase or remotemysql.com? (preferably firebase)

没有。如果您正在寻找一个可以将您的数据库从 SQLite 转换为 Firebase 实时数据库的神奇按钮,那么没有一个!很遗憾,您需要自己转换数据库。

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"

您需要为此编写代码。因此,您应该创建自己的机制来完成 "sync" 工作。