How to determine signal strength when GSM returns '99'?
We have an in-house Android app which is a migration of a pre-existing JME application. There was an issue where users in the field were complaining that the app drained the device battery when it tried to send data when the signal strength was low (this is common behaviour in mobile devices and not our immediate problem)
The data needs to be sent promptly but not immediately, so we placed a check on the signal strength before sending the data. This check used the PhoneStateListener
and the onSignalStrengthsChanged(SignalStrength signalStrength)
callback as recommended by many similar SO questions and articles elsewhere.
This works fine on my own phone (running on Telstra Australia) and SignalStrength.getGsmSignalStrength() returns a value from 0-31
as expected. On a phone running on another network (Optus Australia) however, it reports GSM is true but returns 99 (ie an error code) when determining the signal strength. I believe this is still correct behaviour since GSM is the 2G data and it is the 3G UMTS/HSPA that should be checked. UMTS/HSPA is the network reported by the Elixir
app on the phone, as expected. We have also had unconfirmed reports that my network (Telstra Australia) reports insufficient GSM strength to send data from the application, but is able to browse the internet and perform other data activities without issue. This leads me to believe that the GSM strength is the wrong thing to check anyway.
I am in the process of running tests on other Android phones on the same network (still trying to access some devices) but it is definitely the case that we are able to browse the internet and send (HTTP) data from our application, i开发者_运维知识库t just fails if we check the signal strength and always receive '99'. On Optus, SignalStrength.toString() always returns 99 -1 -1 -1 -1 -1 -1 gsm 3
after several days of testing against multiple towers.
The closest (unanswered) SO thread is this one: Getting Signal Strength RSCP and Ec/Io from a phone served by a HSPA network
In summary:
- Telstra connection reports GSM is true and returns a usable signal strength
- Optus connection reports GSM true but always reports '99'
- GSM is possibly the wrong thing to check anyway, we need to try to obtain the 'actual data transmission network strength'
after testing with multiple handsets from multiple vendors and multiple (Australian) carriers, it appears that this behaviour is specific to the Samsung Galaxy S2 and was not seen on the previous version (Galaxy S).
精彩评论