Two Button Game with Cloud DB

I was working through the CTCT Curriculum and wondering if there was a way to create the Two Button Game and play it on iOS.

The game requires two people to download the apk of the app on two separate phones, since you can't link two phones with AI companion. My hope was to create a single cloudDB and link it to two separate student apps, but I don't know if that is possible

Nevermind! It is completely possible. All you need to do is have the app creator share the ProjectID and Token with the second player. Both people can connect their iOS devices to their individual projects (sharing the same ProjectID and Token) and it works!

Hi @Russell_Strand-Poole,

Thanks for the question and it's good to see you figured out a workable solution. However, two things to keep in mind:

  1. The Token is generated as a function of the user ID. Therefore, it's not recommended to share tokens associated with a user account for security reasons. What you can do instead is use to create an anonymous account and then copy the token from that anonymous account.
  2. Tokens are regenerated when loading the project, but you can bypass this by placing a % at the start of the token.



I appreciate the quick response! I'll keep that in mind. Having a collection of "dummy" accounts for this might not be a bad idea.

This is not mentioned in the CloudDB docs at Storage


This field contains the authentication token used to login to the backed Redis server. For the “DEFAULT” server, do not edit this value, the system will fill it in for you. A system administrator may also provide a special value to you which can be used to share data between multiple projects from multiple people. If using your own Redis server, set a password in the server’s config and enter it here.

Is the '%' respected for Android projects?
Is this worth bookmarking?

1 Like

That's how the system handles it, yes, but I would strongly discourage people doing this for sharing the tokens tied to their personal accounts otherwise anyone can access their CloudDB data across all projects. We have a way on our end to automatically generate these tokens separate from any user account, which is what the documentation refers to.


Hi ewpatton,
I have created 2 cloudDB (just changing the ID) in the same app and I want to connect to it in a different App. So, in the second app I have created 2 cloudDB with the same ID than the ones in the first app (and the same token). Do you think that can work? Because I'm getting sockettimeoutexception and I don't know if it's because what I'm doing makes no sense.
Thank you

A socket timeout exception is usually due to a network issue, not necessarily anything with your app configuration. Make sure that your using the DEFAULT CloudDB server and that if you're doing this on a school network that your IT department has allowed outgoing TCP connections to on port 6381.

So, do you think what I'm trying to do is possible?

I don't see why it wouldn't. There's two pieces of information for uniquely identifying your content on the database side. The first is the Token, which is used to identify the account and authorize access. The second is the ProjectID in the CloudDB component. The combination of these two items is prepended to the tag you give to generate the final primary key that identifies your data. So long as all three items match (token, project ID, tag) then you should be able to retrieve the same data.

Thank you Evan,
Is there any document or tutorial about cloudDB that can help me with the problem I'm having?

I'm not sure exactly what you'll need, but the overall CloudDB documentation is here. If the issue is related to firewalls, then you may want to take a look at this document for what ports various parts of MIT App Inventor need. There's a checklist of things at the end of the document regarding relevant hostnames and ports. If you're still having issues, and it only seems to affect iOS, please send me the AIA and we can evaluate it on our end.

And to share cloudDB between 2 different projects, do I have to write % at the begining of the cloudDB token?

No, the Token is unique to your user, not the project, so it will be the same across projects within your account.