Sharing files among several unauthenticated users

Hello, I need to share a file among different users who are running my app. Specifically, it will work in the following way:

  • One of the users will create a file. The app will store it somewhere, let’s assume in Firebase Storage or FirebaseDB. This will be the only authenticated user (I will use the authentication provided by Firebase).

  • Then the user will send a secret code to the others through whatsapp, for example “A96X3KF4”. At this moment, I am not sure how long this code should be in order to be secure enough.

  • After that, any of the users who received the code should be able to launch the app, enter the code and retrieve the file from the storage. No limit of times during 1 month.

  • Also would be nice to have: if the file changes while any of the users has it open, the app will detect it and show the latest version of the file.

Has anybody faced something similar? Any hints would be appreciated.

I wonder if I should look into the Dropbox API instead, as probably it is more specialized in sending links to shared files.


You are describing the behavior of an app using either the CloudDB or FirebaseDB David or possibly using a shared GoogleSpreadsheet on Google Drive.

Something here might help get you started:

To get specific advice, you might show us what YOU have tried so far. Exactly what you do depends highly on what the ‘file’ is and where it is located on your device. Is it a text file, an image, a sound file? There are limits as to the size and types of ‘files’ that can be exchanged using these tools.

Here are some resources to help you learn to use the AI2 tools A very good way to learn App Inventor is to read the free Inventor’s Manual here in the AI2 free online eBook … the links are at the bottom of the Web page. The book ‘teaches’ users how to program with AI2 blocks.

There is a free programming course here and the aia files for the projects in the book are here:

How to do a lot of basic things with App Inventor are described here: .

Also look here and here for more tutorials.


Thanks Steve for your recommendations. I consider that I have a good level of programming with App Inventor but not so much regarding the cloud systems that I am investigating.

So far, I will describe the best solution I have found.

Regarding your question, the format of the files I need to store in the cloud is JSON, and they are very small (maximum 50 KB). Then my app processes the structured content in the JSON and shows it to the user in a nice way.

My first attempt was to use Firebase Storage, but I see in the licensing that they charge for number of writes and number of reads. Instead, Dropbox only charges for writes and not for reads.

The question I have is if the basic Dropbox Personal account allows all users who use my app to write files using a single dropbox account. That is, the owner of the dropbox account is my app. Anyone know if I would be breaking the license? The idea is that as each user shares their files by creating random links, they decide with whom they want to share them.

The second part that I try to solve is that users know in real time if the file has changed. That is, if they are viewing the contents of a file in the app and at that time it changes, the app should download the latest version of the file and replace the content on the screen. If they have the app in the background, it would be sufficient for the content to reload when the app returns to the foreground.

For this part, I have thought about using Firebase Cloud Messaging. If I have understood it correctly, it will allow me to create closed groups of subscribers, so that when a user shares a random link that has been created in dropbox, other users (only authorized ones) will receive the notifications every time an update of the file occurs.

Of course there is no magic in this part, neither dropbox nor firebase will send notifications automatically. I am planning to schedule the sending of notifications using Firebase Cloud Functions, as follows. Every time a user (from my app) modifies an existing file in dropbox, it runs a Firebase Cloud Functions function that is responsible for sending notifications to subscribers that match a specific “tag”. The tag will be for example the random link created in dropbox.

Subscribers, meanwhile, when they open the app, the Firebase Cloud Messaging service is invoked with the tag corresponding to the file they want to monitor. And from that moment they will start receiving notifications every time there is a change.

I hope I have explained myself well, although surely there are aspects that are not yet well tied.

Thank you.

Why not just store your json as data in a Firebase Database. Spark Plans are “free”

Hi TimAI2, you are absolutely right. When I reread my message, I have realized that it seems that my main concern was the price, while this is of no importance at this time.

However, there is another reason that I did not explain above. I was trying to find a solution that protects my users against brute force attacks.

I mean, the only users who login in the app are those who publish documents, while those who consult documents do not have to login. It is enough that they introduce the random link (or maybe a random identifier in case of using a BD …) of an existing document, and if they succeed … voila, they can already read it.

I understand that Dropbox protects against brute force attacks by blocking mass requests that arrive from the same IP address. Thus the privacy of the documents would be safe.

I wonder if Firebase Database has a similar mechanism. In that case, I agree that it would be the perfect option!

Finally, which of the two: Cloud Firestore or Realtime Database?

(Excerpt from : Realtime Database is Firebase’s original database… We recommend Cloud Firestore instead of Realtime Database for most developers starting a new project.)


Hi, after further investigation, I am posting here my conclusions.

I will be comparing pros and cons of 3 different products from Google:

  • Firebase Realtime Database - Available in AI2 as the Experimental-FirebaseDB component
  • Cloud Firestore - Google’s replacement of Firebase Realtime Database - Not yet available in AI2
  • Cloud Memorystore - Available in AI2 as the Storage-CloudDB component

Firebase Realtime Database

The problem with this option is that it will only allow 100 simultaneous users using my app to connect to the DB. Look for “Simultaneous connections” here: Firebase Pricing Plans

Besides, as I mentioned before, Google is recommending to use to the newer product Cloud Firestore (see next).

Cloud Firestore

This option is more difficult to program, as AI2 does not yet provide a component. However, I imagine that the Cloud Firestore API can be invoked without much trouble using a pattern like the one explained here: Firebase Authentication in App Inventor Using Javascript

I also found this thread with regards this topic, although unfortunately I could not draw any conclusions from it: Cloud Firestore access

Cloud Memorystore

It is available through the AI2 Storage-CloudDB component and it does not seem to have any limit of concurrent connections.

The only cons I noticed, is that it does not provide real time sync, according to the info here (look for “Realtime sync to clients”): Google Cloud Databases

I am not sure what it means. In my particular case, “near real time” would suffice. But I was not able to find more info regarding the degree of delay.

Common cons

The cons that are common in the 3 products, if I understood correctly how they work, is that they will consume a lot of 4G data traffic to the users of my app. The DataChanged event is continually sending ALL changes that are taking place in the DB to ALL users!!

I wonder why a method does not exist to only subscribe to the tag (or tags) that a user is interested in, in order for the DataChanged event only being fired for those tags.

Could anyone who is experienced in these products shed light on the subject?


You don’t mention using Google Drive (files) / Google Sheets (data - 50,000 characters per cell) as an option, in conjunction with a verified google apps script web app ?

Or your own php server…

Thank you TimAI2 for the hint!

How would you implement an event handler in AI2 in order to process the file or sheet every time that any user makes changes on them?

Is there a way to subscribe to receive alerts in Google APIs in order to avoid an active polling?


If you want to avoid/reduce this, then manual update when required by the user may be a better option, depends on how you want your app to work. If you want the “push” / DataChanged functionality then FB is probably the way to go.

For Google Sheets/Drive, realistically you would have to use a timer to check a flag for updates, and download - user’s device would have to be open - same as with FB.

There is CloudDB as well, but you would need to setup your own Redis server (or use redis labs) for this.