Home > Articles > Programming > Java

Exploring MIDP's Push Features

  • Print
  • + Share This
Pushing information or any kind of data to a mobile device offers a huge amount of possibilities for developers. With MIDP 1.0, it was not possible because it supported only Http connections, but MIDP 2.0 supports push in many protocols. Mikko Kontio explains the concepts and classes related to push in MIDP 2.0, and introduces an example application.
Like this article? We recommend

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)
  • + Share This
  • 🔖 Save To Your Account