Android Question How do I send simple Information "via Internet" to another phone?

Chris Hemsw

New Member
Licensed User
Hi,

its my first post here and i'm quite a newbie in using B4A...
So sorry for this "simple" question...but i don't know how to handle this problem with B4A.

I want to send Information(such as integers, strings or booleans) from my "first"phone to another "second"phone, receive these information in B4A-Application and handle with it.
(Sounds quite simple and via WiFi or Bluetooth connection its no problem.)
I've done this already using B4XSerializator Tutorial..
But how to deal with "non local" connections? Can I use this?
I didn't find an example for this in forum.

For example a game that you want to play together. You are not in the same network or Bluetooth range!
But both phones need to swap / exchange information!! (i want to use boolean)
So I thought that its necessary to have a relay (such as a server) to communicate with both phones?!
How does the communication between other "big" apps (like WhatsApp or games with Highscore-lists) work? I Already tried with php-scripts... but that can't be the real thing.

What is the best way to do this using B4A? What library(s) should I use? How can I access a server ?( if i have a www-domain with all features )

Can someone please help me?

Thank you in advance

Chris
 

udg

Expert
Licensed User
One way: use MQTT or Firebase Messaging and have both devices subscribe to the same topic(s).
Another way: as you anticipated, a "server" which operates as a gateway for the "client" devices. You could write the server part making use of B4J and its jserver component although you will need a VPS or anyway full control on the server machine

Both suggestions let you increase the number of partecipating devices at will.
 
Last edited:

aeric

Well-Known Member
Licensed User
You can check on httputils2
 
Top