Exploring MIDP's Push Features
- Push Connections
- Registration
- Example
- References and Further Reading
Any closed environment comes to its limits sooner or later. If a software environment doesn't offer any connectivity features, it offers very limited applications possibilities for developers. MIDP (Mobile Information Device Profile) lies on CLDC (Connected, Limited Device Configuration), which means that the devices are connected to at least one network.
The whole concept of connectivity in MIDP is based on the Generic Connection Framework, which means that all connections can be opened with a single method in one class. The connections are, of course, behind different classes such as HttpConnection. MIDP 1.0 had a very simple connectivity: The only protocol that MIDP 1.0 had to support was HTTP. Some manufacturers have added more protocols, such as socket connections, but developers don't know which devices have them because they weren't in the MIDP 1.0 specification. So in order to use sockets, for example, developers would need to make different version for different devices.
The problem with HTTP is that with applications such as chat, the application has to poll the server constantly for any new messages. This process creates an excessive and unnecessary load on the network. HTTP was a sure shot for the first version of MIDP because it makes possible most of the networking and is implemented in almost every network.
One of the new features in MIDP 2.0 is inbound connections, which allow the MIDlets to be started by a remote connection or a scheduled timer event. Push creates loads of application possibilities such as chat, instant messaging, information services, news services, weather information, schedulers (personal information management systems), security alerts, and so on.
Push Connections
In MIDP 1.0, the Application Management System (AMS) that takes control of installing, starting, and removing applications could start applications only by user action. Now in MIDP 2.0, the AMS can start applications also by incoming connections and scheduled alarms.
The incoming network request can be a message (such as a SMS), a packet (such as a datagram), or a stream (such as a socket). In MIDP 2.0, there's a new class, PushRegistry, that handles almost everything related to push. Below you can see the class's methods:
static String getFilter(String connection) static String getMIDlet(String connection) static String[] listConnections(boolean available) static long registerAlarm(String midlet, long time) static void registerConnection(String connection, String midlet, String filter) static boolean unregisterConnection(String connection)