Saving user Data while uninstalling app

Hello,

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?

Thanks,

Jonathan

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.

Thanks,

Jonathan

If you want to really modify the Manifest, use the APK Editor Studio.

https://qwertycube.com/apk-editor-studio/

I changed it to the following:

<application android:hasFragileUserData="true" </application>
(edited by Taifun using the Preformatted text option)

I don't know why but the messageboard is dropping the final :< / application > from the above line.
I get this error:

App Inventor is unable to compile this project.
The compiler error output was
________Preparing application icon
________Creating animation xml
________Creating style xml
________Creating provider_path xml
________Creating network_security_config xml
________Generating adaptive icon file
________Generating round adaptive icon file
________Generating adaptive icon background file
________Generating manifest file
________Attaching native libraries
________Attaching Android Archive (AAR) libraries
________Attaching component assets
________Invoking AAPT
YAIL compiler - AAPT execution failed.

I am getting something changed now! But obviously still wrong!

Save the data out to the cloud as a matter of course in the app ?

Hello Patryk_F,

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

Thanks,
Jonathan

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.

TinyDb doesn't keep data after uninstalling the App. Unless you're talking about TinyWebDB?

I was referring to this:

There are other conversations about it as well.

Thanks

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

OK I did find a mistake I think and changed it to:

now it compiles but still does ask me if I want to keep my data.

Thanks,

Jonathan

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.

Thanks,

Jonathan

you have to use the Preformatted text option for this to display
preformated text
I edited your post for you...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Thanks Taifun

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

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.