Вопрос

Is there any way to implement push technology in Java ME ie without SMS?

I know stream based/network based notifications is the solution, but how to configure server which sends the notifications to client? How do we get the recipients (clients) address on which notifications is to be send?

There is a tutorial with SMS https://www.ibm.com/developerworks/java/tutorials/wi-midpreg/ but I need implement it over http.

Это было полезно?

Решение

How do we get the recipients (clients) address on which notifications is to be send?

This is how things usually work. When a phone is not using data services it does not have an IP address. When data is requested by the phone it will receive a dynamic IP address and keep it while the data channel is active. This address is unique inside the telecom network and a proxy will make it work with the rest of the internet.

One approach you can use is to have a permanent socket connection between the app and the server, but this does not scale well.

My take? If you get it working with SMS, go with it to wake up your app, then make your app open a connection with the server and download the data it needs. Some phones even allow the app to run without an UI.

Другие советы

Unfortunately there is no standard way for push for all j2me.

It also will be hard to implement yourself because of there is no way to have background app/process for all j2me.

There is solution from Nokia "NNA" that they are pushing right now. But this works only with some recent OS versions.

PushRegistry API documentation (available online) does not limit it to SMS.

In particular, datagram and socket are explicitly listed as examples:

Example Descriptor File Declarative Notation

The following is a sample descriptor file entry that would reserve a stream socket at port 79 and a datagram connection at port 50000. (Port numbers are maintained by IANA and cover well-known, user-registered and dynamic port numbers) [See IANA Port Number Registry]

MIDlet-Push-1: socket://:79, com.sun.example.SampleChat, *
MIDlet-Push-2: datagram://:50000, com.sun.example.SampleChat, *

Note that MIDP 2 specification states that particular protocol support is optional and it is up to implementation whether to enable it for MIDlets:

Connection vs Push Registration Support

Not all generic connections will be appropriate for use as push application transport. Even if a protocol is supported on the device as an inbound connection type, it is not required to be enabled as a valid push mechanism. e.g. a platform might support server socket connections in a MIDlet, but might not support inbound socket connections for push launch capability. A ConnectionNotFoundExceptionis thrown from the registerConnection and from the registerAlarm methods, when the platform does not support that optional capability.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top