Existing namespace

How can I find out which namespaces I had defined and loaded with data?

Hmmmm. Why do you not know the names of the namespaces you set up in your app ?

I set up some namespaces a few month ago to and now when I restart learning I don’t remember them.
I think, that this is a basic problem which must have a solution, isn’t it?

Namespace in TinyDB is here
nameespacetiny

@Juan_Antonio: What do you mean?

Namespace is a TinyDB Property, you mean that NameSpace?

Yes, and my problem is that I don’t remember which Namespaces I defined?

I can’t find out the answer to my question in your example.

Deep into Juan Antonio’s example, he has managed to list the file names in a particular directory …
Capture

The directory on the Android device is /data/user/0/appinventor.USERNAME.APPNAME/shared_prefs

That directory has the various TinyDB namespace XML files.

Others can help you on how to roam your Android file system.

Isn’t there an appinventor solution for that trivial question?

Juan’s extension study provides the backup solution.
Developers should take care when developing…

Unfortunately, no.
If the app developer takes the care to remember all the namespace values in a manifest somewhere, they can handle this in blocks.

Oops.

Answer in the Android forum:

Blockquote

Um auf den Ordner zugreifen zu können, benötigst du a: root und b: einen Dateimanager der mittels root-Rechten auch darauf zugreifen kann.

Blockquote

As I do not know much about the Android system, i'm afraid of destroying the system.
But as the developpers of appinventor do have this experience it would be easy to realize such an app.
I think that I am not the only person who has this problem.

Have you tried this:

Yes I did. But I didn’t get the app running.

To be able to do this, you might need to find the app name that was used to create those namespaces, and build the namespace lister app under the same app name.
However, I am unsure if that won’t flush and rebuild the shared_prefs directory on install of the app.

I ran some experiments, and found I had to customize the kio4 sample,
and to save it in an AI2 server under the original app project name.
(Export your original project as an .aia file to keep the source safe.)
Also save that .aia export file somewhere safe, as usual.
Download this .aia file and rename it to your project file .aia in a temporary location, and
build it on the code.appinventor.mit server to get a new .apk file with your original project name.

Now comes the leap of faith: load the .apk file onto your phone, replacing the executable of your app but keeping the old data there. (I tested this on a Genymotion emulator and successive runs found the old namespace.xml files from prior installs.)

Hit the button to list shared_prefs and look in the label with the yellow background.
If it looks good, you should be able to extend that button click event to strip off .xml suffixes, split at \n to get a list, and write whatever blocks you need to export your namespaces.

I suggest consolidating them into a single merged namespace under tag /namespace/oldtag
for each tag oldtag in namespace namespace.

NameSpaces.aia (13.2 KB)

1 Like

(added to FAQ)