문제

I have used:

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

This gives the long cell ID.

I'm using OpenCellID API to find latitude and longitude of my phone using cell ID, LAC (location area code), MNC (mobile network code) and MCC (mobile country code). Using long cell id gives inaccurate location while using short cell id give accurate location (almost). To test this, I found my phone's short cell id using this app.

But how to find the short cell ID using android API?

도움이 되었습니까?

해결책

It appears that "short cell ID" is nothing but the lower 16 bits of the Long cell ID.

So I used:

int cid = cl.getCid();
short cid_short = (short) cid; 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top