Android Question how to achive this approach

Addo

Well-Known Member
Licensed User
hi i am creating a messaging app using tcp asyncstream

all works fine but now i am trying to do the following

i want to create for each message arrived a customlistview like whats app each conversation have its own messaging list that loaded with its own messages based on client number/or id when client click on this conversation to be opened

is this can be done in b4a ? if yes any idea how ?

i have think to create a List that have text and number and for each message added to this list loaded to clv based on id is what i am thinking to is is fine or there is better way ?
 

KMatle

Expert
Licensed User
Longtime User
I like asynchstreams a lot but don't use it here. I only use it on local networks with up to 200 users or so. I do it like WhatsApp ;-)

I use this components:

- Firebase Messaging (to trigger that a new message is available)
- SQLite (to store the users and chats) lokal
-
PHP & MySQL on my server (very powerful and you've got a layer between the app and the db to check logins, data, etc.)
- several Activities (like one for the chats list and one for the chat with a single user)
- services (to do all the db stuff and communication via OkHttpUtils with my server)
- ScrollViews (here you can add what you want like labels to display the messages)

PS: Instead of using own ScrollViews there are tons of ListViews here to use instead. Take a search.

Workflow

Device A -> User A sends message to User B -> OKHttpUtils Job -> My WebSite -> PHP -> DB -> Get User B's data -> Send FCM message to device B ->

-> get message from server, save it to the local db (and throw notification if app is in the background)

This is how WhatsApp does it.

Benefits

- no traffic on the server handling the messages (it is done by Google's FCM)
- no active connections all the time (this will kill your server). Imagine 1 bilion users are active...
- just a bit db traffic and some checks in php
- only when an app sends or fetches a message from the servers there is traffic on it
- most messages can be put to the FCM message as it can carry 4 KB (so no traffic on the server's db)

PS: Please edit the thread's title to a more specific one like "How to create an messenger app"
 
Upvote 0

Addo

Well-Known Member
Licensed User
my main question were about creating a layout or list for each conversation , and other information is a great advice i will look into it .

the current understanding needed is a good way to create conversations
 
Upvote 0
Top