A
Android Central Question
It looks like Android 11 is designed such that either an app deletes its data when it gets uninstalled or the app stores the data in a remote server.
But my app requirements are different:
My app doesn't store any data on a remote server but it stores user data on user's device itself.
So, my app creates some files in Public Documents directory.
When the app is uninstalled, the data on the device doesn't get deleted.
When the user installs the app again, the app sees that there is previous data in the device and hence it tries to reuse that earlier data.
But, when trying to read the file, Android gives an error/exception that file cannot be read.
I tried setting the file permissions (when it is created for the first time) to anyone can read/write/execute but I don't think that this is working.
So, it looks like the problem is: When the app is installed again, it is a new user in the system and since it is not the owner of the files created by previous installation of the app, Android gives an error/exception.
So, is there any solution?
Or, is it that Android 11 is designed such that either an app deletes its data when it gets uninstalled or the app stores the data in a remote server?
But my app requirements are different:
My app doesn't store any data on a remote server but it stores user data on user's device itself.
So, my app creates some files in Public Documents directory.
When the app is uninstalled, the data on the device doesn't get deleted.
When the user installs the app again, the app sees that there is previous data in the device and hence it tries to reuse that earlier data.
But, when trying to read the file, Android gives an error/exception that file cannot be read.
I tried setting the file permissions (when it is created for the first time) to anyone can read/write/execute but I don't think that this is working.
So, it looks like the problem is: When the app is installed again, it is a new user in the system and since it is not the owner of the files created by previous installation of the app, Android gives an error/exception.
So, is there any solution?
Or, is it that Android 11 is designed such that either an app deletes its data when it gets uninstalled or the app stores the data in a remote server?