Android: StreamingAssets not Updated when APK Update

Hello there,

Well here is my problem:
I use SQLite4Unity that requires my database to be placed in the StreamingAssets folder. This database is meant to be updated in the future with more content. Unfortunately, the files in this folder are not updated when I install an update of the app. I have to delete those files before installing the new version in order to get the new ones.

But how can I do that during the installation?

Can I include my files in my APK and overwrite the files in StreamingAssets? (nasty solution…)

If someone can help me with this, I’ll raise my glass for him during the following aperitif (Hey, I know, but that’s basically the best I can do to thnak you folks :wink: )

A+

Hello, this is my first answer here.

For ages I’ve been trying to update my sqlite db for my game on game update, I even made a massive method that updates everything…
Tonight, after analyzing SQLite4Unity connectDB method, I saw that it first checks if database is in Application.persistentDataPath, if not, it copies the database from streaming assets to persistent storage.

My solution to problem of updating database is simply… deleting it from persistentDataPath…
I added “updated” PlayerPref to check value and see if it needs to run the code.

if (PlayerPrefs.GetInt("update") != up)
{
      _connection.Close();
      File.Delete(Application.persistentDataPath + "/your_db_name");
      connectDB("your_db_name");
      PlayerPrefs.SetInt("update", up);
 }

Please, backup you db before testing this.

Hopefully someone will find this helpful.