I have a free app. If the user buys the paid version I would like them to be able to move their data to the new version.
What is the simplest way to do that?
If I have to add a button in one app for export and another in the other app for import that is fine but I would only like to show those buttons if the other app is installed.
Do you already have both the free & paid versions? If not, in my experience it's much easier to put an in-app purchase in the free app than to have a separate paid app.
If you've already gone down that path then you can give the user an option to back the data up to File.DirRootExternal in the free app & then restore it in the paid one - that's what I do in Five Dice.
I think you can find out if a package is installed using PackageManager.
I think that you should have in both application an option to backup/restore data/settings to a file. Since your paid and free application have the same package name this wouldn't be a problem. I don't see a reason for going to in-app-purchasing. Those options are (or should be) in most applications, to ensure that the data is not lost when the user re-installs an application, or moves application to another device.
I think that you should have in both application an option to backup/restore data/settings to a file. Since your paid and free application have the same package name this wouldn't be a problem. I don't see a reason for going to in-app-purchasing. Those options are (or should be) in most applications, to ensure that the data is not lost when the user re-installs an application, or moves application to another device.
Yes you did. But the question was how to move user data from free app to "full" app? And that's what I suggested in reply #3. And whether it is a same or different package names for the apps, it doesn't matter, as long as a backup file has the same format for both. And the file is accessible by both - which is not a problem.
Note that at least one of the apps will need to request the "read external storage" permission as RuntimePermissions.GetSafeDirDefaultExternal is based on the package name.
Note that at least one of the apps will need to request the "read external storage" permission as RuntimePermissions.GetSafeDirDefaultExternal is based on the package name.
The user data is stored there. But if you want to make a backup of this data (for whatever reason), you don't need to store it there. You can store it in DirRootExternal or on SD, if the device have it, or better still, you let the user select where to store the backup data. It all depends how you design the application. And the backup data can be encrypted as well if you are concerned about the security.
Note that at least one of the apps will need to request the "read external storage" permission as RuntimePermissions.GetSafeDirDefaultExternal is based on the package name.
This is where it got confusing for me. RuntimePermissions.GetSafeDirDefaultExternal doesn't seem to return the same dir for each app. I had to use File.DirRootExternal in order to access the backup file from both apps.
Do you already have both the free & paid versions? If not, in my experience it's much easier to put an in-app purchase in the free app than to have a separate paid app.
If you've already gone down that path then you can give the user an option to back the data up to File.DirRootExternal in the free app & then restore it in the paid one - that's what I do in Five Dice.
I think you can find out if a package is installed using PackageManager.
Yes, package manager gave me what I needed to know. In app purchases seems like the cleanest way for the user but is its own can of snakes as far as implementation and I think I want to provide backup/restore anyway....
This is where it got confusing for me. RuntimePermissions.GetSafeDirDefaultExternal doesn't seem to return the same dir for each app. I had to use File.DirRootExternal in order to access the backup file from both apps.
If you get PERMISSION_WRITE_EXTERNAL_STORAGE, then PERMISSION_READ_EXTERNAL_STORAGE is also granted - so you don't have to request both if you get write permission first.
If you get PERMISSION_WRITE_EXTERNAL_STORAGE, then PERMISSION_READ_EXTERNAL_STORAGE is also granted - so you don't have to request both if you get write permission first.
Yes, I understand that but it doesn't solve the problem. Each app seems to return a different directory for RuntimePermissions.GetSafeDirDefaultExternal.
Yes, I understand that but it doesn't solve the problem. Each app seems to return a different directory for RuntimePermissions.GetSafeDirDefaultExternal.