Chat with push notification (CloudDB and Itoo)

Since the release of the "Itoo 4.1 Sky" version, this extension can interact with the AppInventor component "CloudDB"

We are going to create a Chat application with Push notification relying on this great extension

There is already a manual on how to create a chat with CloudDB

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

In this tutorial we will focus on creating a service that allows us to add push notifications to Chat.

In Screen1.Initialize we indicate the following

First we will start the service

Then we will include our chat user in the shared variable "user"

When we start the service we call the "Start" procedure

There we find the itoo procedure "ExecuteInternalScript" with two arguments:

  • Code: which is a control number
  • Values: there we will include a list with six items, to configure CloudDb
    1- The CloudDB Component
    2- The ProjectId (by changing this data we could make different chat rooms)
    3-RedisPort
    4-RedisServer (clouddb.appinventor.mit.edu)
    5-Token (Redis server start key)
    6-UseSSL (true or false)

This data must match what is indicated in the component properties except RedisServer

In this same "Start" procedure we register the CloudDB1.DataChanged event in the "DataChanged" procedure

propiedades

DataChanged

The "value" argument, as defined in the program, is a list but for reasons unknown to me, the service identifies it as a string, but there are enough tools in App Inventor to extract the data we need.

What the procedure does is remove the user and the message from the last post and present it to us in a notification, this is done even if the app is closed

When you press the notification, the app will open and the chat will be updated in it.

This is a basic chat, but you can go deeper by creating rooms and users with permissions to enter a certain room, you could even create private one-on-one conversations, it all depends on the imagination we have.

Even with our Driver account, we could share all types of files.

For correct operation on Xiaomi and Samsung devices, it is convenient to set the battery saver to No Restrictions.

The notification would have to be configured for the NotifyBasic channel as Allow floating notifications.

ItooChat.aia (105,6 KB)

3 Likes

Hmm. I think this is related to how the CloudDB component operates rather than the Itoo extension.
Does this also happen without using a background process? Your findings will be useful.

Thanks,
Kumaraswamy B G

According to the manual on how to create a chat with CloudDb, the value argument of DataChanged can have a list as its value

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

Can you confirm that when you upload the data to CloudDB, it is in the form of a list or a string?

If you use "AppendValueToList", value will be a list. If you use StoreValue, it will depend on the value you are storing.

In chat example, it is used AppendValueToLis so, the returned value will be a list.

Yes, load the data as a list

2 Likes

A new version of the .aia file is included with the following improvements:

  • Now the service is activated when the device is turned off or restarted

image

  • Authentication is through our Google username, so users are kept unique.
    For this, the Taifun extension "TaifunGoogleAcount" is used (thanks to Taifun for the great extension)
  • Allows you to create different chat rooms
  • Allows you to send Private messages from User to User, the message is produced through a notification
  • If the body of the message is an https link, it will open what that link indicates (web page, pdf files, other types of reading files, photos, videos...)
  • Allows you to select whether we want to receive push notifications or not, private messages will always have a push notification.
  • For the chat design I used the ListViewPlus extension by Patryk_F. (thanks for your great extension)

I hope you like it and it helps you go deeper into the tutorial.

ItooChatV2.aia (310,7 KB)

4 Likes

Is this the same as the tag value of the clouddb?

I would like to ask you for a kindness.
I would like the message sent to appear at the bottom and not at the top, can someone help me please?
also, maybe I'm asking too many things, I'd like to have a button that deletes the message history of a room...... is it possible to do this?
thanks to anyone who will answer and help me

Show us the relevant blocks, see also How to ask a question (open new topic)

Each chat room is a tag in CloudDB? Set that tag to create empty list

Taifun

I'm referring to this ttead's chat. Why should I create a new topic?

Just follow the recommendation of how to ask a question

If you show us a screenshot of what you have, then others are able to provide help without guessing

Taifun

good morning, has anyone tried Mario1's ItooChatV2.aia? I don't know what I'm doing wrong but if I click on the USER button and send a private message the other user doesn't receive any message? If you have tried chat, do you receive a private message? what am I doing wrong ?

[image]