You are here

Get CellId and other Imformation from mobile phones via J2ME

Without GPS or Network Operator we can still use the Location Based Service, via the help of CellId(Cell ID the location of Cell Identities of GSM-networks). Google has one enormous database of cell ids which are linked to a longitude and latitude position, that why Google Map client know where you are even you have no embedded GPS--it is not open. But there are other opened cellid DBs that we can use freely: opencellid , and
Ok, one we can get the cell from phone we can query the location from these cellid DB. In GSM networks, all cells in the world have a globally unique ID made up of four numbers:
cell ID, LAC, MNC, and MCC.

For example, for Motorola:
Using JavaME to obtain Cell Positioning information

  1. {
  2. ….
  3. String cellid = System.getProperty("CellID");
  4. String lac = System.getProperty("LocAreaCode");
  5. String imsi = System.getProperty("IMSI");
  6. // Example IMSI (O2 UK): 234103530089555
  7. String mcc = imsi.substring(0,3); // 234 (UK)
  8. String mnc = imsi.substring(3,5); // 10 (O2)
  9. String location = mcc + mnc + lac + cellID; // A globally unique ID for a cell
  10. }

Information from Truly Mobile JavaME Applications: Location, Media Capture, and Connectivity

But get Cellid is still limited by mobile phone platform, Sign-certificate and Operator:

s40 3rd Fp1 edition, requers operator or manufactureer signing
S60 3rd edition, FP2(released 2008 and newer, does not work on e.g. N95),no singing required

Java platform 7.3 or higher (released around 2006 and newer)
older phone may need firmware update (7.1->7.3)
does not work in SE symbian (ie. UIQ) or windownsmobile(Xperia X1) phone
Information from Terminal-based Mobile Positioning overview

And notice, even you use the right code and sign your application, it is still not possible to query the cellID, because some telecom-operators have limited this service.

The fowllowing J2ME code could help you, J2ME Polish Syntax is used here to make the procedure easier. The functions here is not complete, because some manufactories have not released their J2ME API documents to query the cellID. If you have some information which is not included in the codes please let me and others know, please supplement here, thx!

  1. //#if polish.Vendor == BlackBerry
  2. //#= import net.rim.device.api.system.GPRSInfo;
  3. //#endif
  6. /**
  7. * get the cell id in the phone
  8. *
  9. * @return
  10. */
  11. public static String getCellId(){
  12. String out = "";
  13. try{
  15. out = System.getProperty("Cell-ID");
  16. if(out== null || out.equals("null") || out.equals(""))
  17. out = System.getProperty("CellID");
  18. if(out== null ||out.equals("null")|| out.equals(""))
  19. System.getProperty("phone.cid");
  20. //#if polish.Vendor == Nokia
  21. if(out== null ||out.equals("null")|| out.equals(""))
  22. out = System.getProperty("");
  23. //#elif polish.Vendor == Sony-Ericsson
  24. if(out== null ||out.equals("null")|| out.equals(""))
  25. out = System.getProperty("");
  26. //#elif polish.Vendor == Motorola
  27. if(out== null ||out.equals("null")|| out.equals(""))
  28. out = System.getProperty("phone.cid");//System.getProperty("CellID");
  29. //#elif polish.Vendor == Samsung
  30. if(out== null ||out.equals("null")|| out.equals(""))
  31. out = System.getProperty("");
  32. //#elif polish.Vendor == Siemens
  33. if(out== null ||out.equals("null")|| out.equals(""))
  34. out = System.getProperty("com.siemens.cellid");
  35. //#elif polish.Vendor == BlackBerry
  36. if(out== null ||out.equals("null")|| out.equals(""))
  37. //#= out = GPRSInfo.getCellInfo().getCellId();
  38. //#else
  39. if(out== null ||out.equals("null")|| out.equals(""))
  40. out = System.getProperty("cid");
  41. //#endif
  43. }catch(Exception e){
  44. return out==null?"":out;
  45. }
  47. return out==null?"":out;
  48. }
  50. /**
  51. * get the lac sring from phone
  52. */
  53. public static String getLAC(){
  54. String out = "";
  55. try{
  57. out = System.getProperty("phone.lac");
  59. //#if polish.Vendor == Nokia
  60. if(out== null ||out.equals("null")|| out.equals(""))
  61. out = System.getProperty("");
  62. //#elif polish.Vendor == Sony-Ericsson
  63. if(out== null ||out.equals("null")|| out.equals(""))
  64. out = System.getProperty("");
  65. //#elif polish.Vendor == Motorola
  66. if(out== null ||out.equals("null")|| out.equals(""))
  67. out = System.getProperty("LocAreaCode");
  68. //#elif polish.Vendor == Samsung
  69. if(out== null ||out.equals("null")|| out.equals(""))
  70. out = System.getProperty("");
  71. //#elif polish.Vendor == Siemens
  72. if(out== null ||out.equals("null")|| out.equals(""))
  73. out = System.getProperty("com.siemens.cellid");
  74. //#elif polish.Vendor == BlackBerry
  75. if(out== null ||out.equals("null")|| out.equals(""))
  76. //#= out = GPRSInfo.getCellInfo().getLAC();
  77. //#else
  78. if(out== null ||out.equals("null")|| out.equals(""))
  79. out = System.getProperty("cid");
  80. //#endif
  82. }catch(Exception e){
  83. return out==null?"":out;
  84. }
  86. return out==null?"":out;
  87. }
  89. /**
  90. * Example IMSI (O2 UK): 234103530089555
  91. String mcc = imsi.substring(0,3); // 234 (UK)
  92. String mnc = imsi.substring(3,5); // 10 (O2)
  93. * @return
  94. */
  95. public static String getIMSI(){
  96. String out = "";
  97. try{
  99. out = System.getProperty("IMSI");
  100. if(out== null ||out.equals("null")|| out.equals(""))
  101. out = System.getProperty("phone.imsi") ;
  102. //#if polish.Vendor == Nokia
  103. if(out== null ||out.equals("null")|| out.equals(""))
  104. out = System.getProperty("");
  105. if(out== null ||out.equals("null")|| out.equals(""))
  106. out = System.getProperty("");
  107. //#elif polish.Vendor == Sony-Ericsson
  108. /* if(out== null ||out.equals("null")|| out.equals(""))
  109. out = System.getProperty("com.sonyericsson.imsi");*/
  110. //#elif polish.Vendor == Motorola
  111. if(out== null ||out.equals("null")|| out.equals(""))
  112. out = System.getProperty("IMSI");
  113. //#elif polish.Vendor == Samsung
  114. /* if(out== null ||out.equals("null")|| out.equals(""))
  115. out = System.getProperty("");*/
  116. //#elif polish.Vendor == Siemens
  117. /* if(out== null ||out.equals("null")|| out.equals(""))
  118. out = System.getProperty("com.siemens.imei");*/
  119. //#elif polish.Vendor == BlackBerry
  120. if(out== null ||out.equals("null")|| out.equals(""))
  121. //#= out = GPRSInfo.getCellInfo().getBSIC();
  122. //#else
  123. if(out== null ||out.equals("null")|| out.equals(""))
  124. out = System.getProperty("imsi");
  125. //#endif
  127. }catch(Exception e){
  128. return out==null?"":out;
  129. }
  131. return out==null?"":out;
  132. }
  134. /**
  135. *
  136. * For moto, Example IMSI (O2 UK): 234103530089555
  137. String mcc = imsi.substring(0,3); // 234 (UK)
  138. * @return
  139. */
  140. public static String getMCC(){
  141. String out = "";
  142. try{
  144. if(out== null ||out.equals("null")|| out.equals(""))
  145. out = System.getProperty("phone.mcc") ;
  146. //#if polish.Vendor == Nokia
  147. if(out== null ||out.equals("null")|| out.equals(""))
  148. //out = System.getProperty("");
  149. //#elif polish.Vendor == Sony-Ericsson
  150. if(out== null ||out.equals("null")|| out.equals(""))
  151. out = System.getProperty("");
  152. //#elif polish.Vendor == Motorola
  153. if(out== null ||out.equals("null")|| out.equals("")){
  154. out = getIMSI().equals("")?"": getIMSI().substring(0,3);
  155. }
  156. //#elif polish.Vendor == Samsung
  157. /* if(out== null ||out.equals("null")|| out.equals(""))
  158. out = System.getProperty("");*/
  159. //#elif polish.Vendor == Siemens
  160. /* if(out== null ||out.equals("null")|| out.equals(""))
  161. out = System.getProperty("com.siemens.imei");*/
  162. //#elif polish.Vendor == BlackBerry
  163. if(out== null ||out.equals("null")|| out.equals(""))//getMNC()
  164. //#= out = GPRSInfo.getCellInfo().getMCC();
  165. //#else
  166. if(out== null ||out.equals("null")|| out.equals(""))
  167. out = System.getProperty("mcc");
  168. //#endif
  170. }catch(Exception e){
  171. return out==null?"":out;
  172. }
  174. return out==null?"":out;
  175. }
  177. /**
  178. *
  179. * For moto, Example IMSI (O2 UK): 234103530089555
  180. String mnc = imsi.substring(3,5); // 10 (O2)
  181. * @return
  182. */
  183. public static String getMNC(){
  184. String out = "";
  185. try{
  187. if(out== null ||out.equals("null")|| out.equals(""))
  188. out = System.getProperty("phone.mnc") ;
  189. //#if polish.Vendor == Nokia
  190. if(out== null ||out.equals("null")|| out.equals(""))
  191. out = getIMSI().equals("")?"": getIMSI().substring(3,5);
  192. //#elif polish.Vendor == Sony-Ericsson
  193. if(out== null ||out.equals("null")|| out.equals(""))
  194. out = System.getProperty("");
  195. //#elif polish.Vendor == Motorola
  196. if(out== null ||out.equals("null")|| out.equals("")){
  197. out = getIMSI().equals("")?"": getIMSI().substring(3,5);
  198. }
  199. //#elif polish.Vendor == Samsung
  200. /* if(out== null ||out.equals("null")|| out.equals(""))
  201. out = System.getProperty("");*/
  202. //#elif polish.Vendor == Siemens
  203. /* if(out== null ||out.equals("null")|| out.equals(""))
  204. out = System.getProperty("com.siemens.imei");*/
  205. //#elif polish.Vendor == BlackBerry
  206. if(out== null ||out.equals("null")|| out.equals(""))//getMNC()
  207. //#= out = GPRSInfo.getCellInfo().getMNC();
  208. //#else
  209. if(out== null ||out.equals("null")|| out.equals(""))
  210. out = System.getProperty("mnc");
  211. //#endif
  213. }catch(Exception e){
  214. return out==null?"":out;
  215. }
  217. return out==null?"":out;
  218. }
  220. /**
  221. * not used now
  222. * get the IMEI (International Mobile Equipment Identity (IMEI)) in the phone
  223. *
  224. * @return
  225. */
  226. public static String getIMEI(){
  227. String out = "";
  228. try{
  230. out = System.getProperty("com.imei");
  231. //#if polish.Vendor == Nokia
  232. if(out== null ||out.equals("null")|| out.equals(""))
  233. out = System.getProperty("phone.imei");
  234. if(out== null ||out.equals("null")|| out.equals(""))
  235. out = System.getProperty("");
  236. if(out== null ||out.equals("null")|| out.equals(""))
  237. out = System.getProperty("");
  238. if(out== null ||out.equals("null")|| out.equals(""))
  239. out = System.getProperty("");
  240. //#elif polish.Vendor == Sony-Ericsson
  241. if(out== null ||out.equals("null")|| out.equals(""))
  242. out = System.getProperty("com.sonyericsson.imei");
  243. //#elif polish.Vendor == Motorola
  244. if(out== null ||out.equals("null")|| out.equals(""))
  245. out = System.getProperty("IMEI");
  246. if(out== null ||out.equals("null")|| out.equals(""))
  247. out = System.getProperty("com.motorola.IMEI");
  248. //#elif polish.Vendor == Samsung
  249. if(out== null ||out.equals("null")|| out.equals(""))
  250. out = System.getProperty("");
  251. //#elif polish.Vendor == Siemens
  252. if(out== null ||out.equals("null")|| out.equals(""))
  253. out = System.getProperty("com.siemens.imei");
  254. //#else
  255. if(out== null ||out.equals("null")|| out.equals(""))
  256. out = System.getProperty("imei");
  257. //#endif
  259. }catch(Exception e){
  260. return out==null?"":out;
  261. }
  263. return out==null?"":out;
  264. }

Some J2ME applications are also available:



It would be ahndy if there was a button to copy the code to the clipboard.. Editing out line numbers is a painful and tedious task

To edit out line numbers: there are editors such as kate on linux, or Notepad++ on Windows, that allow "rectangular" selections, so it's easy to get rid of the line numbers.

> s40 3rd Fp1 edition, requers operator or manufactureer signing
how can such a signing be obtained?

read this:

{:)} Hi,

Other than CellID, could it be possible to get other information such as signal stength from some GSM cell tower?


hi, maybe, there is some special jsr specifications from Vendor such as Nokia, you can get some special capabilities. But i am not sure, you need read through the documents from official website. {;)}

Lac code is not returned in Nokia S60 Fp1

yes, right.
S60 3rd edition, FP2 -- released 2008 and newer
means fp1 does not work, fp2, fp3 fp4 and later feature pack will work

Wow thanks for the nice tutorial man. I would say that I had never heard anything about Cellid before reading your post about it. But now I am highly interested in this function and I plan to read more about it. The J2me in the mobile phones is well known for me because I am a junior mobile application developer by myself. Thanks one more time and keep writing good stuff!


Steve Turnton from mobile application development


Dear leelight,

Great post - thanks a lot.
I have inherited JME codebase and Ihave found following properties that you don't check for, however I cannot guarantee how accurate those are.

Best regards,


//All* properties are hexadecimal
//MNC variants

// CellID property found in motorola phones using Siemens modems (could also work on other phones using Siemens modems)


//MCC on some nokias


This will be of great use for me. I appreciate how it is publicly accessible. A lot surely benefited from this entry which is comprehensive and content rich. Thanks for creating this one!

The IMSI contains the MCC and MNC for your home network, and does not change (its is effectively hard-coded into the SIM). If you roam to another network and/or country, the IMSI does not change.
With the code above, if you roam to another country, your location will be incorrect - you have a CellId which is dynamic and for the roaming network, but you will be adding the MCC/MNC from your home network! Result -> Incorrect location.

What you need is the current nework MCC and MNC (which is only the same as the MCC/MNC in the IMSI when you are in your home network)

thank you for this information. you are right. By the way, i think CellId is just the supplement for GPS, it's location is ALWAYS inaccurate :) {:jawdrop:}

[quote=Daniel Drozdzewski]Dear leelight,

Great post - thanks a lot.
I have inherited JME codebase and Ihave found following properties that you don't check for, however I cannot guarantee how accurate those are.

Best regards,


//All* properties are hexadecimal
//MNC variants

// CellID property found in motorola phones using Siemens modems (could also work on other phones using Siemens modems)


//MCC on some nokias


Thank you! it is useful for all !! I can not guarantee my code also, it is not possible to test the code on all the devices.

Hi leelight/Daniel,

thanks for this great information.

Is there a typo in the code related Samsung? You have used imei instead of imsi by mistake, or is not it possible to get imsi for Samsung?

Also, in Daniel's comment, could you please clarify the system properties for Samsung?

signal strength is also needed to get cellid information.

what I found is only for Nokia:

String signal = System.getProperty("");


Excellent post, thank you very much for taking the time to share with those who are starting on the subject. Greetings

Samsung, I have not found so much information for the properties, bad official document. {:(}

very useful info, I was looking for Information on mobile phones with J2ME

Still i am not able to get all phones cellid and other info mainly on motorola em-30, and also some of notation
are not woked as to get cellid in samsung phone code is System.getProperty("Cell-ID"); not the one given in above code.

so please there isany notations or code which works correctly with the dvices.

With regards
Jitain Sharma

I am new in J2ME, and i want to made a application which gets cellid, network name , service provider name, but i don't know how i will do? and it is possible on nokia s60 3rd devices like Nokia 3250, i have done this on symbian, it is possible in j2me?

Wow, thanks for the insightful post. I look forward to reading more from you.

s40 : System.getProperty("")
s60 : System.getProperty("")

eg. "01 (Vodafone I)"

J2ME development has emerged as one of the most popular technologies. Mobile Application developers choose J2ME platform because it includes flexible user interface, robust security, and built-in network protocols and support for networked and offline applications that can be downloaded dynamically. A real advantage with J2ME development is that it enjoys widespread support across all platforms. The need of the hour to fulfill your requirements is to secure, reliable and professional services pertaining to J2ME application development. With the help of effective J2ME application development, one can get the advantages of easy user interface, easy application navigational functionality, better networking capabilities and improved security. For more information, visit at: cash 4 phones. {:)}

I appreciate how it is publicly accessible. A lot surely benefited from this entry which is comprehensive and content rich. Thanks for creating this one!

Hi, guys! Can anyone help me? I have found this blog and the post seems interesting but I am not sure if it suits me. I am going to order a custom dissertation on mobile phones and security. Do you think the post is useful for it? Thanks in advance.

i want to implement gps coordinates with lat&long application in j2me .
and install blackberry.

works fine...Thanks for sharing the information. That’s a awesome article you posted.

Certainly Google has one enormous database of cell ids which are linked to a longitude and latitude position.

That makes a lot of sense now. Right away the first paragraph or so explained it, at least it makes sense to me in a general sense. That's kind of creepy that they can track everything even without the GPS feature though.
phone lookup

i used above code but i got null. does it realy work on your phone ? ( Note: my phone is NOKIA N73)

building solution is India’s #1 portal on building solutions. For building supplies, sustainable/efficient building materials, building construction services, home builder materials, housing materials, visit

need to know
my Nokia E90 isnt showing cellID and AreaID(aka LAC)
do u know any solution for that

also i m working on an SMS app
it always ask for "Allow application ......" "Yes or No"

please help
thanks in advance

Nice to be visiting your blog again, it has been months for me. Well this article that I've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.

Your post will be rather good, and I’m sure some will find it interesting because it’s about a topic that’s as widely discussed as others. Some may even find it useful.Thanks so much for your post.

Wow, nice post,there are many person searching about that now they will find enough resources by your post.Thank you for sharing to us.Please one more post about that..

Today mobile phones become the most important gadget you could ever have. Excellent for communication in every way. affordable health insurance

Great info! Thank you for the post. Really it will b helpful for me. I really love to read such articles for you share different body of knowledge that people should know.

With Regards..
Alena from Android Apps Development

Thanks some great information here keep up the good work. I actually provide a more constructive comment as I'm a bit out of my deph but i will be checking back here for further updates. Goodluck, Roy

I am very interested for this post.This site is so helpful. So I want some information for sharing this side with some of my friend. Thanks for sharing the information in this article.
auto insurance quotes

Great Tutorial Learned New things here, Very informative Post here is the right place where we can expect new articles and helpful for new guys who are intrested to learn. Thanks a lot for sharing this useful and informative post and I will be waiting for other great news from you in the nearest future.

Mike HUdson from Yellow pages Hyderabad

I appreciate how it is publicly accessible. A lot surely benefited from this entry which is comprehensive and content rich. Thanks for creating this one!

I definitely enjoyed every bit of it and I have you bookmarked your blog to check out the new stuff you post in the future

So, does it work on Nokia? I've got a Nokia phone, too, so I wonder if I should bother trying to apply this code...
mobile application development companies

[quote=Adela]So, does it work on Nokia? I've got a Nokia phone, too, so I wonder if I should bother trying to apply this code...
mobile application development companies[/quote]

Useful information shared..Iam very happy to read this article..thanks for giving us nice info.Fantastic walk-through. I appreciate this post. - Cebu

It's looking awesome I will try this code. Thanks for sharing.
Mobile Application Development

i am used this code work well . but how to use the nokia n95? anyway tell me?

[quote=Anonymous]i am used this code work well . but how to use the nokia n95? anyway tell me?[/quote]
find all syntax under "if polish.Vendor == Nokia", use those for Nokia