Reputation: 243
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
Upvotes: 1
Views: 1884
Reputation: 3183
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.
Upvotes: 0