From 766a7d7174b2902d7f6fe2142b29237ffc47f6d3 Mon Sep 17 00:00:00 2001 From: jacques Date: Wed, 17 Mar 2021 13:33:23 +0100 Subject: [PATCH] Use prefManager to update of not the main database --- app/src/main/java/net/foucry/pilldroid/DBMedoc.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/foucry/pilldroid/DBMedoc.java b/app/src/main/java/net/foucry/pilldroid/DBMedoc.java index 6ee8983..76b30e3 100644 --- a/app/src/main/java/net/foucry/pilldroid/DBMedoc.java +++ b/app/src/main/java/net/foucry/pilldroid/DBMedoc.java @@ -57,8 +57,12 @@ class DBMedoc extends SQLiteOpenHelper { public synchronized SQLiteDatabase getReadableDatabase() { File dbFile = myContext.getDatabasePath(dbName); - if (dbFile.exists()) return super.getReadableDatabase(); + //if (dbFile.exists()) return super.getReadableDatabase(); + PrefManager prefManager = new PrefManager(myContext); + int oldVersion = prefManager.getDatabaseVersion(); + + if (oldVersion == DATABASE_VERSION) return super.getReadableDatabase(); copyDatabase(dbFile.getPath()); return super.getReadableDatabase(); }