How To Handle Application Upgrades From Free To Paid Version While Preserving Any Data
Solution 1:
My idea is the following:
- Paid version's
android:versionCode
should be free'sandroid:versionCode
+1 - Both should have the same package.
When paid version is installed, it will replace the free one.
Actually it will update it, since it has a higher android:versionCode
.
As both have the same package, they will be placed in the same folder ( /data/data/your.package
) so the paid app will be able to access the free app db.
Solution 2:
The answer is: this is not solvable with Android Market, because Market does not allow the upload of two apps with the same package name. Android cannot be tricked into installing the premium version over the free version and treat it as an upgrade.
The good news: adding database backup/restore functionality (copying the database to the SD card and back to the app folder) only required a few lines of code. My users will have to install both versions in parallel, back up the database from the free version and restore it to the premium version.
Solution 3:
Instead of backing up the database to and from the SD card (as suggested by @cdonner), which requires the WRITE_EXTERNAL_STORAGE
permission, the free app can expose a ContentProvider
, which the paid app can use to transfer data.
Be sure to use permissions to secure your content.
Post a Comment for "How To Handle Application Upgrades From Free To Paid Version While Preserving Any Data"