r/tasker•
bevardimus

[HELP] How to get current LTE signal strength into a variable?

Help

The context "variable set %CELLSIG" works great for getting 3G signal strength, but not for LTE signals. Is there an intent which supplies this same functionality for LTE? Any ideas would be greatly appreciated. Thanks, Reddit!

EDIT: I do not want to root.

Posted Aug 19, 2015, 3:43 PM UTC · edited

1618
plepleus📱S5 Lollipop, no root•

This should work for Android 4.2 and new, but it will only get it within a task not helpful for a profile to trigger a task: Cell Strength LTE (146) A1: Java Function [ Return:cssl Class Or Object:CellSignalStrengthLte Function:new {CellSignalStrengthLte} () ] A2: Java Function [ Return:%asu Class Or Object:cssl Function:getAsuLevel {int} () ] A3: Java Function [ Return:%dbm Class Or Object:cssl Function:getDbm {int} () ] A4: Java Function [ Return:%level Class Or Object:cssl Function:getLevel {int} () ] A5: Java Function [ Return:%timing Class Or Object:cssl Function:getTimingAdvance {int} () ]

The above old one won't work, but this one will, still requiring 4.2 (API 17) or newer:

SS By Type (147)
A1: Java Function [ 
    Return:tm 
    Class Or Object:TelephonyManager 
    Function:new {TelephonyManager} (Context) 
    Param:CONTEXT ] 
A2: Java Function [ 
    Return:info 
    Class Or Object:tm 
    Function:getAllCellInfo {List} () ] 
A3: Java Function [ 
    Return:obj 
    Class Or Object:info 
    Function:get {Object} (int) 
    Param:0 ] 
A4: Java Function [ 
    Return:%class 
    Class Or Object:obj 
    Function:getClass {Class} () ] 
A5: If [ %class ~ android.telephony.CellInfoLte ]
A6: Java Function [ 
    Return:lte 
    Class Or Object:info 
    Function:get {CellInfoLte} (int) 
    Param:0 ] 
A7: Java Function [ 
    Return:cssl 
    Class Or Object:lte 
    Function:getCellSignalStrength {CellSignalStrengthLte} () ] 
A8: Java Function [ 
    Return:%asu 
    Class Or Object:cssl 
    Function:getAsuLevel {int} () ] 
A9: Java Function [ 
    Return:%dbm 
    Class Or Object:cssl 
    Function:getDbm {int} () ] 
A10: Java Function [ 
    Return:%level 
    Class Or Object:cssl 
    Function:getLevel {int} () ] 
A11: Flash [ 
    Text:dBm:%dbm, asu:%asu, level:%level 
    Long:Off ] 
A12: Else If [ %class ~ android.telephony.CellInfoGsm ]
A13: Java Function [ 
    Return:gsm 
    Class Or Object:info 
    Function:get {CellInfoGsm} (int) 
    Param:0 ] 
A14: Java Function [ 
    Return:cssg 
    Class Or Object:gsm 
    Function:getCellSignalStrength {CellSignalStrengthGsm} () ] 
A15: Java Function [ 
    Return:%asu 
    Class Or Object:cssl 
    Function:getAsuLevel {int} () ] 
A16: Java Function [ 
    Return:%dbm 
    Class Or Object:cssg 
    Function:getDbm {int} () ] 
A17: Java Function [ 
    Return:%level 
    Class Or Object:cssl 
    Function:getLevel {int} () ] 
A18: Flash [ 
    Text:dBm:%dbm, asu:%asu, level:%level 
    Long:Off ] 
A19: Else If [ %class ~ android.telephony.CellInfoCdma ]
A20: Java Function [ 
    Return:cdma 
    Class Or Object:info 
    Function:get {CellInfoCdma} (int) 
    Param:0 ] 
A21: Java Function [ 
    Return:cssc 
    Class Or Object:cdma 
    Function:getCellSignalStrength {CellSignalStrengthCdma} () ] 
A22: Java Function [ 
    Return:%asu 
    Class Or Object:cssl 
    Function:getAsuLevel {int} () ] 
A23: Java Function [ 
    Return:%dbm 
    Class Or Object:cssc 
    Function:getCdmaDbm {int} () ] 
A24: Java Function [ 
    Return:%level 
    Class Or Object:cssl 
    Function:getLevel {int} () ] 
A25: Flash [ 
    Text:dBm:%dbm, asu:%asu, level:%level 
    Long:Off ] 
A26: Else 
A27: Flash [ 
    Text:Unknown type of cell signal 
    Long:Off ] 
A28: End If 
5
bevardimusOPNexus 6, Lollipop, no root•

Nice, I'll try this! Still need a trigger, though...

1
Ratchet_Guy(Mod) 📱Note 4. Lollipop. no root.•

Yeah I used the first one with the 5 Actions and came back with some strange results. Can you post XML for this?

1
plepleus📱S5 Lollipop, no root•
1
Ratchet_Guy(Mod) 📱Note 4. Lollipop. no root.•

Works great!! Nice.

1
plepleus📱S5 Lollipop, no root•

Were you getting the dBm and level as 2147483647? I think it's some sort of error value.

1
Ratchet_Guy(Mod) 📱Note 4. Lollipop. no root.•

Yup. I was like hmmm..

1
1Bagpiper•

Am also curious, but what do you plan on doing with it? I have a profile for WiFi and it uses cell near with 5 towers at my house. I don't have the best signal and can walk a few minutes and lose it. I think atleast one of those cell id's is 4g. It's just hard to figure out which with tasker.

3
bevardimusOPNexus 6, Lollipop, no root•

I need to trigger a task when LTE signal strength changes, store the value into a variable and then use it on a widget display.

1
1Bagpiper•

Are you trying to set it when only the LTE signal on a certain tower or location (work/home) changes or when you have any LTE signal change?

1
bevardimusOPNexus 6, Lollipop, no root•

Nothing like this. Just making an aesthetic widget.

1
Ratchet_Guy(Mod) 📱Note 4. Lollipop. no root.•

Note you'll have to set a Profile to run on a time-repeat-basis as the solution is mainly a Task.

So if you want to check every 5 or 10 minutes, you'd just set a Time Profile to every 5 or 10 minutes and then run the Task that /plepleus posted.

1
bevardimusOPNexus 6, Lollipop, no root•

Makes sense, I just don't understand why LTE is so different from 3G when it comes to this...

1
Ratchet_Guy(Mod) 📱Note 4. Lollipop. no root.•

The best way I can explain it is:

3G != LTE

 

2
Ratchet_Guy(Mod) 📱Note 4. Lollipop. no root.•

Also what widget display are you using (or planning to use)? Zooper?

1
bevardimusOPNexus 6, Lollipop, no root•

Zoom. (I know)

1
[deleted]•

[deleted]

-2