1

i have been working to find right CellID in android network. i am trying to search tutorial, i found the solution something like this:

telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
cellLocation = (GsmCellLocation) telephonyManager.getCellLocation();

Then to access CellID, use this code:

cellLocation.getCid() % 0xffff

When i run the apps, i got an ID number. But, the problem is different IDCELL with G Nettrack apps as reference. Then, the CELLID doesn't match with original data. Please help! Thanks

Samsul Arifin
  • 247
  • 1
  • 6
  • 24

1 Answers1

0

I think you are doing wrong calculation. For GSM network: it should be '&' instead of '%'

GsmCellLocation loc = (GsmCellLocation) tm.getCellLocation();
 if (loc != null) 
  {
  long cellID = loc.getCid() & 0xffff;
  }

For 4g/LTE cellid's, there is a good article written here.follow that.

Madhukar Hebbar
  • 3,113
  • 5
  • 41
  • 69