Hi,

I am trying to access the current cell location information. When I
try to call getCellLocation() it returns null.

I am unable to reason out this.. the same code works on 1.5 but fails
on 1.6 or 2.1.(Tested on G1 with 1.6 and HTC legend 2.1).

Can some one help me in correcting this bug? My code is below.

<Code>
        TelephonyManager tMgr = (TelephonyManager)
getSystemService(TELEPHONY_SERVICE) ;
        outputView = (TextView) findViewById(R.id.output) ;

        outputView.append("Device type:"+tMgr.getPhoneType()+"\n") ;

       GsmCellLocation gsmCellLocation = (GsmCellLocation)
tMgr.getCellLocation() ;
       if (gsmCellLocation != null) {
          String mCellId = "" + gsmCellLocation.getCid() ;
          String mLAC = "" + gsmCellLocation.getLac() ;
          Log.d("SDKService" , "Cell Id: "+mCellId+" LAC: "+mLAC) ;
          outputView.append("Cell Id: "+mCellId+" LAC: "+mLAC+" MCC: "+mMCC+"
MNC: "+mMNC+"\n") ;
       }
</Code>

Also, I have added the following permissions :

ACCESS_FINE_LOCATION,
ACCESS_COARSE_LOCATION,
CONTROL_LOCATION_UPDATES.

Do I need to add any other permissions?

Kindly let me know where I have gone wrong.

Thanks in advance,
Regards,
Vinay

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to