2013-10-17 60 views
1

我用:如何找到短小區ID?

TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); 
GsmCellLocation cl = (GsmCellLocation) telephonyManager.getCellLocation(); 
int cid = cl.getCid(); 

這使長小區ID。

我使用OpenCellID API來使用小區ID,LAC(位置區域代碼),MNC(移動網絡代碼)和MCC(移動國家代碼)查找手機的經度和緯度。使用長單元格ID給出不準確的位置,同時使用短單元格ID給出準確的位置(幾乎)。爲了測試這個,我使用這個app找到了我手機的短小區ID。

但如何找到使用android API的短細胞ID?

+0

你碰巧知道一些關於這個(相關的)問題嗎? http://stackoverflow.com/questions/19247775/simulate-cellular-network-on-eclipse-emulator –

回答

4

看起來「短小區ID」只不過是長小區ID的低16位。

所以我用:

int cid = cl.getCid(); 
short cid_short = (short) cid;