Sharing Data with users on different devices (using the CloudDB)?

I'm relatively new to the imt app inventor and i have to make an app as a school project. My app includes a game with a stopwatch. The player with the shortest time sets the new high-score. I used a clouddb to store the data but it doesnt seem to send the data to other devices. Is it possible to share the data with other users? Did I use the wrong storage?

I also googled and watched a lot of yt videos but i couldnt find one that answered my question.

1 Like

Welcome Karl.

Yes. :astonished:

Here is a CloudDB example showing how data is shared with other users.

https://appinventor-mit-edu.ezproxy.canberra.edu.au/explore/ai2/clouddb-chat

Your app has multiple issues, the main issue is you do not have a CloudDB.DataChanged block in your Project.

Do the tutorial; see how the CloudDB sharing works, then apply the technique to your game.

You might also look at the documentation for CloudDB to get additional explanation about how the Blocks work.

When you have done that, create a simple CloudDB app that shares one piece of information. Get that to work. Remember, to test your app you basically need at least two Android devices with your compiled aia installed on each (or you can install on one and use a second device using Companion in live development). How are you testing to see what works (and what does not work). With a little bit of patience, you will get your app to work.

Also, here is a game using CloudDB that can be played on two devices.

You can try it out also to see how the database works.

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 App Inventor 2 Book: Create Your Own Android Apps ... 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 Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps

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

Also look here App inventor español. Offline. Tutorial. Ejemplos. Instalación. Códigos. Juegos. Curso gratis de App inventor. and here http://www.imagnity.com/tutorial-index/ for more tutorials

Learn about components Component Reference
and visit the Library The MIT App Inventor Library: Documentation & Support Help>Library on the MENU

I made an app as a school project and im using a cloud for it. My teacher doesnt know why its not working so i hope somebody can help me.

The programm is supposed to save a highscore and show it on other devices.

Your timing is off.

The work you do at the bottom of screen initialization to show scores is too early.

The data you requested has not yet arrived.

Move that code into the cloudDB Got Data event, and be more respectful of the tags and their values.

Hello
I'm still working on my school project and there are still a lot of errors. I also want to apologize in advance for the names of the elements and that I'm asking again. The cloud does save data but it doesnt show the right one on the screen. The highscore is selected with a stopwatch. The person with the shortest time wins.

Both me and my teacher already tried to find my mistake but we couldnt fix it for several hours.

I see from your blocks that you store score information from global variables into TinyDB in the initialization section of screen gratulation.

The initialization event runs at screen startup, when global variables have not had a chance to be updated in other events, so you will always be storing zeroes or blanks.

AI2 global variables do not persist across screens.

To pursue this further, we would also have to see how scores are generated and saved in the other screens.

By the way, for a small app like this, it is easier to stick to one screen and use stacked vertical arrangements, only one visible at a time.