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 , mobiforge.com and http://realtimeblog.free.fr/
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
{
….
String cellid = System.getProperty("CellID");
String lac = System.getProperty("LocAreaCode");
String imsi = System.getProperty("IMSI");
// Example IMSI (O2 UK): 234103530089555
String mcc = imsi.substring(0,3); // 234 (UK)
String mnc = imsi.substring(3,5); // 10 (O2)
String location = mcc + mnc + lac + cellID; // A globally unique ID for a cell
}
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:
Nokia
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
SonyEricsson:
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!
//#if polish.Vendor == BlackBerry
//#= import net.rim.device.api.system.GPRSInfo;
//#endif
/**
* get the cell id in the phone
*
* @return
*/
public static String getCellId(){
String out = "";
try{
out = System.getProperty("Cell-ID");
if(out== null || out.equals("null") || out.equals(""))
out = System.getProperty("CellID");
if(out== null ||out.equals("null")|| out.equals(""))
System.getProperty("phone.cid");
//#if polish.Vendor == Nokia
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.nokia.mid.cellid");
//#elif polish.Vendor == Sony-Ericsson
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.sonyericsson.net.cellid");
//#elif polish.Vendor == Motorola
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("phone.cid");//System.getProperty("CellID");
//#elif polish.Vendor == Samsung
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.samsung.cellid");
//#elif polish.Vendor == Siemens
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.siemens.cellid");
//#elif polish.Vendor == BlackBerry
if(out== null ||out.equals("null")|| out.equals(""))
//#= out = GPRSInfo.getCellInfo().getCellId();
//#else
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("cid");
//#endif
}catch(Exception e){
return out==null?"":out;
}
return out==null?"":out;
}
/**
* get the lac sring from phone
*/
public static String getLAC(){
String out = "";
try{
out = System.getProperty("phone.lac");
//#if polish.Vendor == Nokia
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.nokia.mid.lac");
//#elif polish.Vendor == Sony-Ericsson
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.sonyericsson.net.lac");
//#elif polish.Vendor == Motorola
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("LocAreaCode");
//#elif polish.Vendor == Samsung
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.samsung.cellid");
//#elif polish.Vendor == Siemens
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.siemens.cellid");
//#elif polish.Vendor == BlackBerry
if(out== null ||out.equals("null")|| out.equals(""))
//#= out = GPRSInfo.getCellInfo().getLAC();
//#else
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("cid");
//#endif
}catch(Exception e){
return out==null?"":out;
}
return out==null?"":out;
}
/**
* Example IMSI (O2 UK): 234103530089555
String mcc = imsi.substring(0,3); // 234 (UK)
String mnc = imsi.substring(3,5); // 10 (O2)
* @return
*/
public static String getIMSI(){
String out = "";
try{
out = System.getProperty("IMSI");
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("phone.imsi") ;
//#if polish.Vendor == Nokia
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.nokia.mid.mobinfo.IMSI");
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.nokia.mid.imsi");
//#elif polish.Vendor == Sony-Ericsson
/* if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.sonyericsson.imsi");*/
//#elif polish.Vendor == Motorola
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("IMSI");
//#elif polish.Vendor == Samsung
/* if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.samsung.imei");*/
//#elif polish.Vendor == Siemens
/* if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.siemens.imei");*/
//#elif polish.Vendor == BlackBerry
if(out== null ||out.equals("null")|| out.equals(""))
//#= out = GPRSInfo.getCellInfo().getBSIC();
//#else
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("imsi");
//#endif
}catch(Exception e){
return out==null?"":out;
}
return out==null?"":out;
}
/**
*
* For moto, Example IMSI (O2 UK): 234103530089555
String mcc = imsi.substring(0,3); // 234 (UK)
* @return
*/
public static String getMCC(){
String out = "";
try{
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("phone.mcc") ;
//#if polish.Vendor == Nokia
if(out== null ||out.equals("null")|| out.equals(""))
//out = System.getProperty("com.nokia.mid.mobinfo.IMSI");
//#elif polish.Vendor == Sony-Ericsson
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.sonyericsson.net.mcc");
//#elif polish.Vendor == Motorola
if(out== null ||out.equals("null")|| out.equals("")){
out = getIMSI().equals("")?"": getIMSI().substring(0,3);
}
//#elif polish.Vendor == Samsung
/* if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.samsung.imei");*/
//#elif polish.Vendor == Siemens
/* if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.siemens.imei");*/
//#elif polish.Vendor == BlackBerry
if(out== null ||out.equals("null")|| out.equals(""))//getMNC()
//#= out = GPRSInfo.getCellInfo().getMCC();
//#else
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("mcc");
//#endif
}catch(Exception e){
return out==null?"":out;
}
return out==null?"":out;
}
/**
*
* For moto, Example IMSI (O2 UK): 234103530089555
String mnc = imsi.substring(3,5); // 10 (O2)
* @return
*/
public static String getMNC(){
String out = "";
try{
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("phone.mnc") ;
//#if polish.Vendor == Nokia
if(out== null ||out.equals("null")|| out.equals(""))
out = getIMSI().equals("")?"": getIMSI().substring(3,5);
//#elif polish.Vendor == Sony-Ericsson
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.sonyericsson.net.mnc");
//#elif polish.Vendor == Motorola
if(out== null ||out.equals("null")|| out.equals("")){
out = getIMSI().equals("")?"": getIMSI().substring(3,5);
}
//#elif polish.Vendor == Samsung
/* if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.samsung.imei");*/
//#elif polish.Vendor == Siemens
/* if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.siemens.imei");*/
//#elif polish.Vendor == BlackBerry
if(out== null ||out.equals("null")|| out.equals(""))//getMNC()
//#= out = GPRSInfo.getCellInfo().getMNC();
//#else
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("mnc");
//#endif
}catch(Exception e){
return out==null?"":out;
}
return out==null?"":out;
}
/**
* not used now
* get the IMEI (International Mobile Equipment Identity (IMEI)) in the phone
*
* @return
*/
public static String getIMEI(){
String out = "";
try{
out = System.getProperty("com.imei");
//#if polish.Vendor == Nokia
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("phone.imei");
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.nokia.IMEI");
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.nokia.mid.imei");
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.nokia.mid.imei");
//#elif polish.Vendor == Sony-Ericsson
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.sonyericsson.imei");
//#elif polish.Vendor == Motorola
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("IMEI");
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.motorola.IMEI");
//#elif polish.Vendor == Samsung
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.samsung.imei");
//#elif polish.Vendor == Siemens
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("com.siemens.imei");
//#else
if(out== null ||out.equals("null")|| out.equals(""))
out = System.getProperty("imei");
//#endif
}catch(Exception e){
return out==null?"":out;
}
return out==null?"":out;
}
Some J2ME applications are also available:
http://www.ottaky.com/midlets.php#netmon2
http://www.cellspotting.com/webpages/cellspotting.html
Ref:
http://en.wikipedia.org/wiki/GSM_localization
http://www.paxmodept.com/telesto/blogitem.htm?id=531
http://www.slideshare.net/jaakl/terminalbased-mobile-positioning-overview-presentation
http://www.ottaky.com/midlets.php#netmon2
http://www.cellspotting.com/webpages/cellspotting.html
Comments
Re: Get CellId and other Imformation from mobile phones via J2ME
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
Re: Get CellId and other Imformation from mobile phones via J2ME
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.
Re: Get CellId and other Imformation from mobile phones via J2ME
> s40 3rd Fp1 edition, requers operator or manufactureer signing
how can such a signing be obtained?
Re: Get CellId and other Imformation from mobile phones via J2ME
read this:
http://www.easywms.com/?q=en/node/3578
Re: Get CellId and other Imformation from mobile phones via J2ME
{:)} Hi,
Other than CellID, could it be possible to get other information such as signal stength from some GSM cell tower?
Thanks!
Re: Get CellId and other Imformation from mobile phones via J2ME
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. {;)}
Re: Get CellId and other Imformation from mobile phones via J2ME
Lac code is not returned in Nokia S60 Fp1
S60 3rd edition, FP2 -- released 2008 and newer
yes, right.
S60 3rd edition, FP2 -- released 2008 and newer
means fp1 does not work, fp2, fp3 fp4 and later feature pack will work
Re: Get CellId and other Imformation from mobile phones via J2ME
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!
Sincerely,
Steve Turnton from mobile application development
Re: Get CellId and other Imformation from mobile phones via J2ME
Thanks!
Re: Get CellId and other Imformation from mobile phones via J2ME
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,
Daniel
//All com.sonyericsson.net.* properties are hexadecimal
//MNC variants
com.sonyericsson.net.cmcc
com.sonyericsson.net.mcc
com.sonyericsson.net.cmnc
com.sonyericsson.net.mnc
com.sonyericsson.net.lac
com.sonyericsson.net.cellid
//----------------------------
// CellID property found in motorola phones using Siemens modems (could also work on other phones using Siemens modems)
Siemens.CID
//LAC
phone.lai
//MCC on some nokias
com.nokia.mid.countrycode
//Samsung
CELLID
LAC
MCC
MNC
Re: Get CellId and other Imformation from mobile phones via J2ME
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!
Be careful using IMSI-derived MCC and MNC for location!
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)
Re: Be careful using IMSI-derived MCC and MNC for location!
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:}
Re: Get CellId and other Imformation from mobile phones via J2ME
[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,
Daniel
//All com.sonyericsson.net.* properties are hexadecimal
//MNC variants
com.sonyericsson.net.cmcc
com.sonyericsson.net.mcc
com.sonyericsson.net.cmnc
com.sonyericsson.net.mnc
com.sonyericsson.net.lac
com.sonyericsson.net.cellid
//----------------------------
// CellID property found in motorola phones using Siemens modems (could also work on other phones using Siemens modems)
Siemens.CID
//LAC
phone.lai
//MCC on some nokias
com.nokia.mid.countrycode
//Samsung
CELLID
LAC
MCC
MNC
[/quote]
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.
Re: Get CellId and other Imformation from mobile phones via J2ME
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("com.nokia.mid.networksignal");
Thanks...
Re: Get CellId and other Imformation from mobile phones via J2ME
Excellent post, thank you very much for taking the time to share with those who are starting on the subject. Greetings
Re: Get CellId and other Imformation from mobile phones via J2ME
Samsung, I have not found so much information for the properties, bad official document. {:(}
Re: Get CellId and other Imformation from mobile phones via J2ME
very useful info, I was looking for Information on mobile phones with J2ME
Re: Get CellId and other Imformation from mobile phones via 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
Re: Get CellId and other Imformation from mobile phones via J2ME
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?
Re: Get CellId and other Imformation from mobile phones via J2ME
Wow, thanks for the insightful post. I look forward to reading more from you.
Re: Get CellId and other Imformation from mobile phones via J2ME
s40 : System.getProperty("com.nokia.mid.mnc")
s60 : System.getProperty("com.nokia.mid.networkID")
Re: Get CellId and other Imformation from mobile phones via J2ME
com.nokia.mid.networkid
eg. "01 (Vodafone I)"
Re: Get CellId and other Imformation from mobile phones via J2ME
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. {:)}
Re: Get CellId and other Imformation from mobile phones via J2ME
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!
Re: Get CellId and other Imformation from mobile phones via J2ME
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.
Re: Get CellId and other Imformation from mobile phones via J2ME
Hi
i want to implement gps coordinates with lat&long application in j2me .
and install blackberry.
Re: Get CellId and other Imformation from mobile phones via J2ME
works fine...Thanks for sharing the information. That’s a awesome article you posted.
Re: Get CellId and other Imformation from mobile phones via J2ME
Certainly Google has one enormous database of cell ids which are linked to a longitude and latitude position.
Re: Get CellId and other Imformation from mobile phones via J2ME
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 got null
i used above code but i got null. does it realy work on your phone ? ( Note: my phone is NOKIA N73)
Re: Get CellId and other Imformation from mobile phones via J2ME
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 buildshoppe.com.
Re: Get CellId and other Imformation from mobile phones via J2ME
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
Re: Get CellId and other Imformation from mobile phones via J2ME
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.
Re: Get CellId and other Imformation from mobile phones via J2ME
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.
Re: Get CellId and other Imformation from mobile phones via J2ME
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..
Re: Get CellId and other Imformation from mobile phones via J2ME
Today mobile phones become the most important gadget you could ever have. Excellent for communication in every way. affordable health insurance
Re: Get CellId and other Imformation from mobile phones via J2ME
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
Re: Get CellId and other Imformation from mobile phones via J2ME
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
Re: Get CellId and other Imformation from mobile phones via J2ME
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
Re: Get CellId and other Imformation from mobile phones via J2ME
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
Re: Get CellId and other Imformation from mobile phones via J2ME
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!
Re: Get CellId and other Imformation from mobile phones via J2ME
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
Re: I got null
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
Re: I got null
[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
Re: Get CellId and other Imformation from mobile phones via J2ME
It's looking awesome I will try this code. Thanks for sharing.
Mobile Application Development
Re: Get CellId and other Imformation from mobile phones via J2ME
i am used this code work well . but how to use the nokia n95? anyway tell me?
Re: Get CellId and other Imformation from mobile phones via J2ME
[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