Submitting the web server to the J2ME application

Can a J2ME application start a message from a remote web server. I want to complete the task on the client’s mobile phone as soon as the J2ME application running on it receives this message. I read about the HTTP connection, however, I understand that this is a client protocol, and the server will only respond to client requests. Any idea if there is any protocol where the server can send a command to the client without a click initiating any request ?. What about Socket / Stream (TCP) or UDP interfaces ?.

+3
source share
4 answers

If your mobile device does not allow you to make TCP connections and you are limited to HTTP requests, then you are looking at a “long polling”.

One HTTP POST request and the web server will wait as long as possible (before the timeout). If something arrives while the connection is idling, it can receive it directly, if something arrives between requests for a long poll, it is queued until the request appears.

If you can connect to TCP connections, just configure the connection and let it stay idle. I have icq and irc applications that essentially just sit there, waiting for the server to send something.

+3
source

PushRegistry, SMS , , SMS, HTTP- - . , , , , , SMS, SMSLib Kannel

+2

"" ( "" ) . , :

Display.getDisplay(MyMIDlet.instance).setCurrent(null);

, , , canvas:

Display.getDisplay(MyMIDlet.instance).setCurrent(this);

.

+2

Socket support is supported by j2me. But it can only work if your server can transfer data to your mobile phone. Most likely, this operator’s gateway does not allow this. Perhaps it would be possible if your mobile phone has a static external IP address - some operators may provide this for $$.

+1
source

Source: https://habr.com/ru/post/1714536/


All Articles