cell tower strength stored in a variable?

Is there a way to access the cell tower strength in a variable? I don't mean the WiFi strength; I mean a numerical value for 'number of bars' symbol.
 

tanutanu

Well-known member
try shell script action as below:
getprop vendor.ril.nw.signalstrength.lte.1

The last value means SIM1. Change to 2 when you want to get SIM2.
 

Attachments

  • Screenshot_20210915-184024_copy_1080x1048.png
    Screenshot_20210915-184024_copy_1080x1048.png
    98.9 KB · Views: 6

tanutanu

Well-known member
Thank you for posting this. The programming is a bit heavy for me, but maybe I should get more into shell scripts.
Don't worry. You need to write just few lines if you want to get and display cell radio wave strength value only.
It might be too redundant coz I wrote it when I was newbie to check up MD features.
 

Dm114

Well-known member
Don't worry. You need to write just few lines if you want to get and display cell radio wave strength value only.
It might be too redundant coz I wrote it when I was newbie to check up MD features.
Unfortunately it only works on rooted devices...☹️
 

tanutanu

Well-known member
hmm...would you try the test procedure as below:
1. Open shell console via a terminal emulator like Terminal Emulator for Android. https://play.google.com/store/apps/details?id=jackpal.androidterm
2. Simply type "getprop"
3. If you got a bunch of system variables, you are around the last corner.
4. Type "getprop | grep signalstrength" or "getprop | grep lte"
5. If you can find similar key, type "getprop <key name what you get>"

Some devices might have different keys especially single SIM. However, I believe any manufacturers provide getprop command without removal.
 
Last edited:

tanutanu

Well-known member
@Dm114, I'm very sorry. I noticed one of my devices which was updated to Android 11 doesn't get the value correctly. It should be available below Android 10. I will try to find the key on 11 later. Thanks for letting me know that:)
 

Dm114

Well-known member
@Dm114, I'm very sorry. I noticed one of my devices which was updated to Android 11 doesn't get the value correctly. It should be available below Android 10. I will try to find the key on 11 later. Thanks for letting me know that:)
I'm on Samsung A40 - Android v9
 

tanutanu

Well-known member
Thank you for posting this. The programming is a bit heavy for me, but maybe I should get more into shell scripts.
Robert,
I'm so sorry if you use a Android 11+ device. Finally, I gave up using getprop command on my 11 device coz I couldn't discover the replaced value. It might be hidden by Google as the result of the update.
Alternatively, I would like to suggest another option to get the value via Termux api, it might be a little harder though.

Termux is working as a plugin of MD and called via Tasker/Locale Plugin Action.
To use a Termux api command, you need to write a small wrapper shell script and install it to the exact directory located under the app home(/data/data/com.termux/files/home/.termux/tasker as absolute path).

#!/bin/sh termux-telephony-cellinfo

The script write JSON data structure to standard out(Termux terminal screen) like below and you can catch it into a MD variable. Please note that you have to make a MD variable to receive the return string.

[ { "type": "lte", "registered": true, "asu": 60, "dbm": -80, "level": 4, "ci": 72654338, "pci": 493, "tac": 63968, "mcc": 440, "mnc": 11 }, { "type": "lte", "registered": false, "asu": 32, "dbm": -108, "level": 1, "pci": 174 }, { "type": "lte", "registered": false, "asu": 33, "dbm": -107, "level": 1, "pci": 285 }, { "type": "lte", "registered": true, "asu": 36, "dbm": -104, "level": 2, "timing_advance": 5, "ci": 44286804, "pci": 425, "tac": 5784, "mcc": 440, "mnc": 10 }, { "type": "lte", "registered": false, "asu": 32, "dbm": -108, "level": 1, "pci": 254 }, { "type": "lte", "registered": false, "asu": 20, "dbm": -120, "level": 0, "pci": 33 } ]

Once you get it, you can extract "dbm" key's value where "registered" is true and "mnc" is same as your SIM(1 or 2).
If it is complicated for you, I'm very sorry, I have no other idea😿
 
Top