×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    5

    Unable to retrieve Cellid and LAC (tested on nokia E50)

    I have been trying to get celllid,lac,mcc and mnc. While mcc and mnc can be found,cell-id and lac still are null.Here's the code (and it is known to work according to number of threads going on but I still can't get it to work)


    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    /**
    * @author lalchetian
    */
    public class LocInfo extends MIDlet {
    private Form form;
    private Display display;
    public void startApp() {
    form = new Form("Location...");
    String cellid = getCellId();
    String getLAC = getLAC();
    String getMCC = getMCC();
    String getMNC = getMNC();
    form.append(cellid);
    form.append("<-this is cell-id");
    form.append(getLAC);
    form.append("<-this is LAC");
    form.append(getMCC);
    form.append("<-this is MCC");
    form.append(getMNC);
    form.append("<-this is MNC");
    display = Display.getDisplay(this);
    display.setCurrent(form);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    /**
    * get the cell id in the phone
    *
    * @return
    */
    public static String getCellId(){
    String out = "";
    try{


    out = System.getProperty("com.nokia.mid.cellid");
    }catch(Exception e){
    System.out.println(e);
    out=e.toString();
    return out;
    }

    return out==null?""ut;
    }

    /**
    * get the lac sring from phone
    */
    public static String getLAC(){
    String out = "";
    try{

    out = System.getProperty("com.nokia.mid.lac");

    }catch(Exception e){
    out=e.toString();
    return out;
    }

    return out==null?""ut;
    }

    /**
    * 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(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");

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.sonyericsson.imsi");

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("IMSI");

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.samsung.imei");

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.siemens.imei");

    if(out== null ||out.equals("null")|| out.equals(""))
    //#= out = GPRSInfo.getCellInfo().getBSIC();

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("imsi");


    }catch(Exception e){
    return out==null?""ut;
    }

    return out==null?""ut;
    }

    /**
    *
    * 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(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.sonyericsson.net.mcc");

    if(out== null ||out.equals("null")|| out.equals("")){
    out = getIMSI().equals("")?"": getIMSI().substring(0,3);
    }

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.samsung.imei");

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.siemens.imei");

    if(out== null ||out.equals("null")|| out.equals(""))//getMNC()
    //#= out = GPRSInfo.getCellInfo().getMCC();

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("mcc");


    }catch(Exception e){
    return out==null?""ut;
    }

    return out==null?""ut;
    }

    /**
    *
    * 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(out== null ||out.equals("null")|| out.equals(""))
    out = getIMSI().equals("")?"": getIMSI().substring(3,5);

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.sonyericsson.net.mnc");

    if(out== null ||out.equals("null")|| out.equals("")){
    out = getIMSI().equals("")?"": getIMSI().substring(3,5);
    }

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.samsung.imei");

    /* if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.siemens.imei");*/

    if(out== null ||out.equals("null")|| out.equals(""))//getMNC()
    //#= out = GPRSInfo.getCellInfo().getMNC();

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("mnc");


    }catch(Exception e){
    return out==null?""ut;
    }

    return out==null?""ut;
    }

    /**
    * 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(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");

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.sonyericsson.imei");

    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");

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.samsung.imei");

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("com.siemens.imei");

    if(out== null ||out.equals("null")|| out.equals(""))
    out = System.getProperty("imei");


    }catch(Exception e){
    return out==null?""ut;
    }

    return out==null?""ut;
    }
    }




    I have taken code from here - >http://www.easywms.com/easywms/?q=en/node/3589 (Iwant it to run on nokia e50 as of now and hence used com.nokia.mid.cellid (in fact i have tried all other options mentioned on this link as well)) Cellid and lac both returns null while mcc and mnc are returned correctly.

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Unable to retrieve Cellid and LAC (tested on nokia E50)

    E50 is S60 3rd Edition device
    That device does not support those system properties. See here
    http://library.developer.nokia.com/t...B925CF670.html

    Hartti

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    5

    Re: Unable to retrieve Cellid and LAC (tested on nokia E50)

    Thanks for the reply Hartti, Then how do you get cellid and lac in series 60 phone?

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,560

    Re: Unable to retrieve Cellid and LAC (tested on nokia E50)

    Quote Originally Posted by lalchetian View Post
    Thanks for the reply Hartti, Then how do you get cellid and lac in series 60 phone?
    By using Symbian C++ instead of Java.

  5. #5
    Registered User
    Join Date
    Jun 2011
    Posts
    5

    Re: Unable to retrieve Cellid and LAC (tested on nokia E50)

    I just tried this on E63 and it does return Cellid with same code.... How ever IT doesn't now return lac,mcc or mnc while in E50 it used to return mcc and mnc and not the other two...! Why is it so?

  6. #6
    Registered User
    Join Date
    Jun 2011
    Posts
    5

    Re: Unable to retrieve Cellid and LAC (tested on nokia E50)

    @petrib
    You mean to say there is no way to do it in java? but it did get cellid on E63

  7. #7
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,560

    Re: Unable to retrieve Cellid and LAC (tested on nokia E50)

    See the SDK documentation. The cellid property works on S60 3rd Ed. FP2 and later, but not on earlier.

  8. #8
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Unable to retrieve Cellid and LAC (tested on nokia E50)

    The link to the relevant documentation is in my post above.
    Note that E63 is using newer platform version than E50, so it has a little more capabilities for Java.

    In general, there is way less access to the lower-level phone stuff from Java than there is from Symbian C++ / Qt. This is one example of such cases.

    Hartti

Similar Threads

  1. CellId or LAC
    By cyrille72 in forum Mobile Java General
    Replies: 4
    Last Post: 2011-06-23, 11:29
  2. How can I get Cellid,LAC in Nokia mobiles
    By s.abulkalamazad in forum Mobile Java General
    Replies: 4
    Last Post: 2010-07-22, 07:44
  3. how to get cellID and LAC
    By jackjojo in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-02-14, 07:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×