How do I generate a QR code to allow patients to join private chat room?

Hi all,
I am making an app for therapists and their patients and i want to add a feature where patients can access a chat room or therapyspace by scanning a QR code given to them by their therapists.
Can anyone help?
Thank you so much!

1 Like

Your therapist needs to generate a QR code for each patient. Here is one way Bingo & QR code (how can I build a scavenger hunt game using bar codes). The example talks about a game; the principle applies to your use of a QR code.

Patient would use the BarCode reader to access the chat patient List if there is one.

Chat room options >

hi SteveJG,
Thank you so much for your reply.
i am trying to allow the therapist to generate a QR code or even a regular code and then the send this to the patient via whatsapp or email. After the patient has received this QR code or regular code they can scan it or type it into the app and access their personal chat room.

adding chats to the chat(listview). this part is working but i want the patient to only be able to join if the code they have imputed is correct or the QR code they have scanned.
than you so much for your help

How about creating different tags for different chats. The name of the tag will be the code/passwor.
I know an extension that generates QR code. I'll put it here once I find it. (I saw it on Kodular Community, I guess)

Edit: @Alaqmar_Bohori found it :blush: (see below)

1 Like

I found these on PuraVidaApps' extension directory

1 Like

You got the chat working. Congratulations. Now you need to write the code to generate a pass word and create multiple Tags that point to secure patient/doctor chat rooms.

Before you code the access code @superdojo it would be wise to create the code to create separate chat rooms for the doctor and each user. See


Once you can create these 'rooms', you can decide how to create a unique identifier/password that you can send to the patient as a QRcode image.
You can use simple ways to generate this number perhaps using a random number generator or a more sophisticated way for better security. Here are some suggestions: Search results for 'unique' - MIT App Inventor Community .

Before your create a QR code image you need to create the pass code value that the QR code will contain.

Before you create the password/number you need to be able to create multiple chat rooms. Kaustuba's suggestion is a good one. There are examples in the link I provided earlier.

Here is a similar, current chat where someone is building a similar app How do I retrieve only users name from firebase to load them in list in another screen? .

1 Like

thank you, i will try this.

ok,thank you so much. i will try this

I was wondering if it is possible to do this feature if the doctor and the patient have different screens?

You asked an interesting question.

  1. you could experiment and see if it is possible using your single chat example code. Keep in mind the CloudDB documentation. Place one CloudDB component on one Screen and another on a second Screen. What happens? If you can make it work, then the answer is yes. Keep in mind, the 'chat' conversation must be resident on each Screen, so there needs to be CloudDB controls on each.

  2. I would go another route; rather than go through the pain of attempting to use multiple Screens, consider a single Screen and build virtual screens for the patient and the doctor. Building Apps with Many Screens explains how. I know this would work. It requires only a single CloudDB component.

  3. ask yourself how an app like this would work with your Chat code and why you would even want separate screens if you are using separate doctor/patient Tags for each conversation.

If you don't already have multiple chat rooms, how would separate Screens for the doctor and patient work? Have you figured out how to make multiple chat rooms yet?

1 Like

Okay, thank you so much.
i am still trying to do this. i was wondering is there a possible way to make a screen which depending on the button clicked to access this screen, certain parts are only visible. Im not sure if I'm being clear enough. But basically the therapist also has other information on the screen where the chat function is and i do not want the patient to be able to see this information.
I have tried to do this but am not being able to. Please can you help. thank you.

Did you do any experimenting with many screens tutorial to learn how to work with layouts?
Do you have a way to indicate the doctor is signed in and the ability to allow a patient?
Do you have a boolean variable to indicate if this is the doctor?

If VerticalArrangement1 is the layout where the doctor confidential information is placed. Place the chat dialog in a different VerticalArrangement that both doctor and patient share. Something like the following would work:

if doctorVariable = true then VerticalArrangement1.Visible = true else VerticalArrangement1.Visible = false

i have coded this feature now and I think its working but i dont know how to test it as it can only be tested two way.
Does anyone know?
thank you so much.

To test a CloudDB chat app you need:

  • two Android devices (2 cell phones or a cellphone and a tablet) both connected to WIFI or network (data).
  • build an apk and load that version on both devices
  • You can also use a cell phone or tablet with the installed apk for one person and use your emulator for the other. This works for a chat game I made. You do not have to install the apk in the emulator; just use your emulator with the code you used to create the apk. :slight_smile:

Set up one device to be the doctor, the other device to be the patient; then you can alternately use one device or another to 'chat'. ( alternatively, use your cell for the doctor and the emulator for the patient).

Does it work for you? If not try the chat game

Mountain Kingdom - a chat real time two player, two device game using the CloudDB and a Canvas .

Load the aia; compile the apk; load the apk on your cell phone; run the game using the emulator. The emulator version communicates with the version loaded to your cell.

thank you so much it worked!

1 Like

i have made the code slightly more complex and am stuck! I'm not sure why but it is not working. Basically the doctor creates the QR code on another screen and then gives it to their patient. Then both the doctor and the patient will scan the QR code to access their personal chatroom.I have attached my blocks. Can someone please spot the mistake. Thank you so much.

These are the blocks to store the codes:

The users have to write their name when they open the "Real time session" screen(the chatroom).

Then the users scan their QR code:blocks (10)

I check if the code exists or not:

These are the rest of my blocks:

I'm not sure what I did wrong but everytime I test the app, it says the code was not found. I'm new to app inventor so I'm sure its something simple.
Can someone please help. Thank you so much!

EDIT:Also, should I use a cloudDB or a Firebase. I'm not sure. Thank you. PLEASE HELP.

Hi everyone,
Thank you so much for all your help.
I have figured it out now. YAY :))
Thank you.