Using 1 tinydb with 2 apps


#3

Yes, it has to be stored locally.


#4

Ok, so I built two apps to see if I could pass data between them. Long story short it can’t be (easily) done. It specifically says in the docs:

You cannot use the TinyDB to pass data between two different apps on the phone, although you can use the TinyDB to share data between the different screens of a multi-screen app.

Source: http://ai2.appinventor.mit.edu/reference/components/storage.html#TinyDB

If you think about it from a security perspective, it would be a terrible idea to allow one app access data that was stored by another app.

In the screenshot below I’ve added the File component. Perhaps as a work-around you could store you data as as .csv or similar directly in the file system, this way it would be accessible to both (well, all!) apps.

If you have concerns about storing in a plain-text format then there are many fine encryption extensions available. You can choose from @Taifun or @Andres_Cotes

https://puravidaapps.com/aes.php


#5

también puede utilizar esta extensión pasa obtener la tinydb completa

https://groups.google.com/forum/#!msg/mitappinventortest/7-zmkoNA47E/-iovL7GEBAAJ


#6

@WebAtelier_mt 2 apps on same device or you are talking about different devices?


#7

what about having only one app and inside the app a menu to choose between “app 1” and “app 2”?
Taifun


#8

I think they have to make 1 app for the user and the other is admin


#9

The apps are on one device.


#10

I think, this is no solution. I would do it but meanwhile my app has over 5.000 blocks. So I plan to make another app with other/or new features for customers, but the should have acces to the same cients as they use in app 1.

It’s difficult to add more blocks, because I don’t now when appybuilder hangs up. I already have the problem that live testing is no more working (neither with wlan nor with usb)


#11

I think it is best to use firebase or online server, but if you need offline solution then you can use text file. The text file can consist of a list. Text file can be accessed by multipe apps. It is persistent and you can easily back it up by upload it. You can read the text file as a list and treat list item index as a tag.


#12

Thanks for the info, but the textfile could be read from everyone.


#13

you might want to follow tip 3

It’s difficult to add more blocks, because I don’t now when appybuilder hangs up. I already have the problem that live testing is no more working

try to split screens with too much blocks…

Taifun


#14

In couple of days, We’ll have a new minor-release today will help with blocks performance and may help your situation.


#15

Well, you can use some blocks for abstraction or maybe encryption if you want to protect the text contents. Taifun has an extension for encryption.


#16

Let me add to the discussion that while I was checking the tag and values during debugging my app I found that it had tags and values in it from a completely different app, which was not running at the moment?? To be more precise it has tags of 2 other apps in it?
I used the .ClearAll to get rid of the old ones. And can’t tell you how they sticked in there (maybe the app crashing ?).


#17

@SteveJLV I don’t believe that’s true. Were you running using companion?


#18

see the documentation http://ai2.appinventor.mit.edu/reference/components/storage.html#TinyDB

When you are developing apps using the AI Companion, all the apps using that Companion will share the same TinyDB. That sharing will disappear once the apps are packaged and installed on the phone. During development you should be careful to clear the Companion app’s data each time you start working on a new app.

Taifun


#19

I replied on the mail… But as I stated there, it was the “discovery” of the weird tags that led me to this topic.


#20

@SteveJLV Please see reply above from @Taifun


#21

@SteveJLV, does it happen on installed apps?


#22

No, I noticed it only once and came here (this topic) while trying to find out what was going on. I worked on a few apps over a longer period.