Android Question communication from php page to b4a app?

yuval

Member
Licensed User
Longtime User
hi,
i want a php page on a web server (joint account) to notify a b4j program running locally, or if possible to notify a b4a app.
how is the best way to do this ? register a url in web database, and the php page opens a socket with this url ?
thanks.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Unless the network is specifically configured for incoming connections then it is not possible.

You should use push notifications to notify your Android application. You can use FirebaseNotifications. It should be simple to convert the B4J code that creates the request to PHP.

Sending a notification to a desktop application will be more difficult. If you were using a B4J server then you could have implemented a solution based on web sockets. Such as this one: https://www.b4x.com/android/forum/threads/custom-websocket-based-push-framework.40272/#content
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Only other way I know is polling. the app polls the server for "updates" using HTTPutils every so often. And the server will need a script specifically for that.
 
Upvote 0

yuval

Member
Licensed User
Longtime User
yes, but i dont want polling, i cant poll the server too much, and if i have 100 k users, it is too much.
and even if i have one app , and i want it responsive, i cant poll every 10 seconds.
 
Upvote 0
Top