I thought I saw something on here, but I cannot find it. Forgive me if this question has been answered, but do point me in the right direction. Since we are all moving to Android 11 and the sandbox ASD. I noticed even if I have user created files generated by my app saved in the ASD, Android does not ask me if I want to keep my data when I uninstall the app. Thus it gets deleted along with the App as far as I can tell. Is there any extension or checkbox somewhere, to make sure this question gets asked? If it does get asked, and answered affirmatively, I assume when you reinstall the app it then installs the app to the same directory so the data is retrievable again?
Ok I did some digging.
Looks like one needs to get this added to the manifest:
android:hasFragileUserData="true"
I then found this:
However I am sure I need more words in front of and behind the statement. As the extension I generated does not seem to do anything the app behaves as it did before without asking me if I want to keep my data.
That is my next plan if this doesn't work, this would be so clean though for keeping the app updated on the playstore as I wouldn't have to take the extra step of APK Editor Studio. ( I also have never used it so I am hesitant!)
That is a good suggestion too, and would work, but I would have to code it in to my app. I would also have to have it do it periodically, as the user may not be online at times. I was also reading about how tinydB persists after uninstall, and was thinking perhaps I could exploit that by keeping a file saved in the directory and a list or dictionary copy of that file in the tinydB always. But I don't know if the tinyDB persistence is guaranteed or not.
Might be better to say that tinyDB cannot be relied upon to retain data after uninstall. It is not supposed to, but there have been some reports of this happening, but usually in relation to using development mode (companion on device, then installing apk on device, etc.)
Hey Thanks for the suggestion about APK Editor studio.
Though it would be really cool to have a checkbox with the FileStorage feature to turn this on. It would also be nice to have that manifest modifier extension work, but I have it working after modifying the manifest by hand.
in case you do not get the manifest modifier to work, alternatively you could write your own simple extension, which only adds that option into the manifest...
more information about how to create an extension see the App Inventor Extensions document
see also the document App Inventor Annotations