Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Revision as of 06:55, 30 July 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to get cell information in Java ME using CBS

From Wiki
Jump to: navigation, search

This Java ME code snippet shows how to obtain cell information using the Cell Broadcast Service (CBS).

Article Metadata
Platform(s): Symbian only
Created: im2amit (27 Aug 2009)
Last edited: hamishwillee (30 Jul 2013)



How to capture the cell information, which is displayed on the home screen of most of the GSM phones, if you set the Cell Info Display: ON in your phone settings. Cell info provides some (area)location related text info about the cell tower our device is present at the moment, along with some service providers advertisements. We don't have direct API in Java ME to capture this Cell Info from our application.


This Cell info is broadcasted as CBS (Cell Broadcast Service) message by the cell towers and received by all the GSM phones connected to this tower on certain predefined Channel (generally 050) by most of the service providers. Thus our Java ME application can listen to this CBS Channel using Push Registry and capture this information

Sample Code


import javax.wireless.messaging.*;


Register your Midlet for Listening to CBS port 50 and setup a Message Listener

public void setupListening()
}catch(Exception e){}
String[] connList;
connList = PushRegistry.listConnections(true);
if((connList == null) || (connList.length == 0))
// You can exit the app, if you want
msgconn = (MessageConnection)"cbs://:50");
} catch( IOException e){ e.printStackTrace();}


To Retrieve the CBS message payload.

public void notifyIncomingMessage(MessageConnection conn)
txtmsg =(TextMessage)msgconn.receive();
}catch(Exception e){System.out.println(e);}
from = txtmsg.getAddress());
Msg = txtmsg.getPayloadText();
// Display from & Msg


WMA 120/205 does not support CBS on most of the Nokia Series 40 devices, it works on Symbian and other devices.

The support for receiving CBS messages has been introduced in newer Series 40 5th Edition, Feature Pack 1 devices, all Series 40 5th Edition, Feature Pack 1 Lite devices and all Series 40 6th Edition devices.

--Submitted by Amitabh Srivastava at 16:10(IST), 27 August 2009.

This page was last modified on 30 July 2013, at 06:55.
45 page views in the last 30 days.