Revision as of 13:37, 27 August 2009 by im2amit (Talk | contribs)

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

How to get cell information in Java ME using CBS

From Nokia Developer Wiki
Jump to: navigation, search


How to capture the Cell Info, 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 realted text info about the cell tower our device is present at the moment, along with some service providers advertisements. We dont have direct API in JavaME 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 Codelets

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

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)Connector.open("cbs://:50");
} catch( IOException e){ e.printStackTrace();}

To Retrive 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

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

86 page views in the last 30 days.