2

I have just installed adb and I am trying to retrieve information on the cellular tower which my phone is connected to. My phone is a Samsung Galaxy Trend Lite running Jelly Bean OS (4.1.2). I have rooted the phone and I am using the adb shell as super user.

I tried to use dumpsys telephony.registry from the shell, which gave me a cellInfo parameter, but it's equal to null.

I would like to retrieve a string with info like MCC, MNC, LAC, and CID possibly. Is this feasible? Is this the right way or is there a better one?

UPDATE 1

As suggested by @xavier_fakerat I opened a terminal in ubuntu and I typed adb logcat | grep -E 'MCC|MNC'. However I received the following message which does not seem useful to me (maybe I'm wrong...)

I/SA ( 2688): [OR] onReceive log=[SA = 1.6.0125 V = 16 HWD = 800X480 1.5 dpi = 240 SIZE = 2 LOCALE = it_IT CSC = ITV MCC = 0 MNC 0 T = user DEVICE = kylevess P = kylevessxx I = JZO54K M = GT-S7390 OKLEFT false DIS JZO54K.S7390XXUAOI1 PSS = 3.979127307850313 ]

UPDATE 2

I also tried the suggestion of @Ali Said and I was able to get the cid, although the output sometimes is equal to 0, sometimes is 68. I did the second option he proposed

adb logcat -b radio | grep "cid"

and received many rows like

D/RIL     ( 1391): RIL:[AP][RPC EN] msgid=0x413a str=MSG_MS_GET_ELEMENT_REQ tid 472 cid 68

or

D/RIL     ( 1391): RIL:[AP][RPC DE] msgid=0x204 str=MSG_RSSI_IND tid 0 cid 0

So now I think I am left with finding the LAC code only. Nevertheless, none of the solutions so far allowed me to retrieve all the info i was looking for at the same time. Also, option 1 of @Ali Said (adb logcat -b radio | grep ": +CREG:") seems what I REALLY need, but it doesn't output anything. Maybe it's a matter of the +CREG command (if it is an AT command as far as I can understand), which is not supported by my phone. Just a guess, I went very far for my possibilities, but I am pretty sure I am approaching the solution...

Finally, the output from adb logcat -b radio | grep "MCC" is

D/RIL ( 1391): GetSamsungPLMNname:: GetSamsungPLMNname :: deci MCC=222, MNC=88

while here is a link to the logcat from the cid info. Hope this could be of interest if someone wants to help me out.

2

Both of these worked for me:

Option1: grep AT command for cell info

$> adb logcat -b radio | grep ": +CREG:" 
D/AT      (  873): +CREG: 2,1,"2444","0FA2A694",6
D/AT      (  873): +CREG: 2,1,"2444","0FA2A694",6
D/AT      (  873): +CREG: 2,1,"2444","0FA2A694",6

[1] phone is registered with the network [2444] hex : Location Area Code (LAC) [0FA2A694] hex : Cell Id (cid).

Option 2 : you can grep "cid" from logact -b radio you should get it this. note it is decimal this time.

$> adb logcat -b radio | grep "cid"
D/use-Rlog/RLOG-RIL( 9193): cid: 262317716
D/use-Rlog/RLOG-RIL( 9193): cid: 262317716
D/use-Rlog/RLOG-RIL( 9193): cid: 262317716

Option1 is my personal preference. hope that helps.

  • So, I tried both options. Option 1 didn't print anything. Option 2 instead is a bit different than your output. It shows many different lines and sometimes cellid is 0 some others is 68. So I suppose now I can get both the MNN, MNC and CELLID but I would still need LAC to get my phone's location with (e.g.) Google geolocation API. I'll update my question to this last update and possibly include a part of the output I am receiving from logcat. – umbe1987 Apr 1 '17 at 15:27
  • 1
    Forget to mention that those logcat are for KitKat ... if you are after newer version use this adb logcat -b radio | grep -e "< VOICE_REGISTRATION_STATE" -e "< DATA_REGISTRATION_STATE" 03-31 16:25:06.619 2727 2966 D RILJ : [2823]< DATA_REGISTRATION_STATE {1, fffe, 0032d102, 14, null, 4, 0x29e1, null, 0x0032d102, null, null, 0} [SUB0] fffe : is LAC in hex 0032d102 : cell Id in hex – Ali Said Apr 5 '17 at 21:27
  • Hey sorry for the late reply. I tried that and it worked (although I am using an OLDER version which is jelly bean). So, if you feel to update your answer with your last comment, I'll be happy to accept it! thanks again! – umbe1987 Apr 27 '17 at 15:41
1

You may need to use adb logcat and filter using grep. Try this

adb logcat | grep -E 'MCC|MNC'

Credits

  1. Getting cell id through adb
  • Thanks. I tried that. opening a terminal in ubuntu I typed adb logcat | grep -E 'MCC|MNC' but I received I/SA ( 2688): [OR] onReceive log=[SA = 1.6.0125 V = 16 HWD = 800X480 1.5 dpi = 240 SIZE = 2 LOCALE = it_IT CSC = ITV MCC = 0 MNC 0 T = user DEVICE = kylevess P = kylevessxx I = JZO54K M = GT-S7390 OKLEFT false DIS JZO54K.S7390XXUAOI1 PSS = 3.979127307850313 ]. I updated my question to include this. – umbe1987 Mar 25 '17 at 10:29
  • Something wrong with the SIM card, doesn't return any MNC and MCC values, the other values are extracted from logcat info, and might not seem useful, but if are are after cell info, then MCC and MNC should be the focus, however to my surprise it's still returning null values. Is the network locked? – xavier_fakerat Mar 25 '17 at 10:45
  • Thanks again. What do you mean by "Is the network locked"? My SIM is from Wind, I am from Italy. If you can suggest how I can check if the network is indeed locked and possibly if there's a way to unlock it (if this would likely fix the problem) I'll be very thankful. Anyway, really appreciate your help! – umbe1987 Mar 25 '17 at 11:10
  • 1
    @umbe1987 I am suspecting something else now. Please check /data/data/com.android.providers.telephony/databases/telephony.db. Do you see any information on mobile country codes or networks? I suspecting this file might be missing telephony info , causing MCC and MNC to return null values.However I am not entirely sure so a discussion is welcome – xavier_fakerat Mar 25 '17 at 14:27
  • So, I did adb shell logcat /data/data/com.android.providers.telephony/databases/telephony.db >> /home/umberto/Desktop/out.txt. I then looked into "out.txt" and searched for the term "mcc" and I actually found an interesting thing: I can see the same string I posted in my answer, with MCC and MNC = 0, but also two others where I read D/MccTable( 1910): updateMccMncConfiguration: mcc=222, mnc=88, and D/MccTable( 1910): locale set to it_it. From cellidfinder.com/mcc-mnc I read that it refers to "Wind Telecomunicazioni SpA" which is my company in Italy. – umbe1987 Mar 25 '17 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.