Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by MEDIALLIANCE_2 · Feb 18, 2016 at 05:20 PM · androidsqlitestreamingassets

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 ;-) )

A+

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MEDIALLIANCE_2 · Mar 14, 2016 at 09:32 AM 0
Share

Still not managed to find the solution. The "easy" solution is to make the user uninstall the app before installation, that means no update... this is something...

avatar image MEDIALLIANCE_2 · Aug 17, 2016 at 07:42 AM 0
Share

Still no answers to this question? I thought I wasn't the only one bothered by this restriction... Solution are suggested there (but not tested yet): http://answers.unity3d.com/questions/611534/on-android-how-can-i-update-files-in-the-strea$$anonymous$$g.html

https://github.com/codecoding/SQLite4Unity3d/issues/37

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by m_vulicevic · May 09, 2017 at 05:21 AM

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MEDIALLIANCE_2 · May 09, 2017 at 07:19 AM 0
Share

This is good information, thanks! I can't check this (this question was asked last year) but it seems to be a good solution. Thanks again m_vulicevic!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Android - Use SQLite database in other folder than StreamingAssets folder 0 Answers

Sqlite4Unity3d difficulties 1 Answer

Best Way To Store Credentials and Data Online? 1 Answer

How to create a SQLite database in Android 0 Answers

Open an HTML file from streamingAssets - Android 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges