tags:

views:

503

answers:

2

I'm writing an android application that collects cell signal strengths. I am having trouble getting the "current" cell signal strength, but I don't have any problem getting the "neighboring" cell signal strengths.

To get the current cell signal strength, I created a PhoneStateListener and implemented the onSignalStrengthChanged callback. It works, but not very well. It seems like the signal strength hardly ever changes, and resolution jumps to only a few numbers. I would accept the answer that the resolution of the signal strength hardware is coarse, but when I use the TelephonyManager's getNeighboringCellInfo() method, it works much better. The signal strength readings from neighboring cells change frequently, and they have much better resolution.

So, how can I get the current cell signal strength in the same way that I am getting the neighboring cell strengths? It seems odd to me that the functionality of the neighboring cells is better than the current cell. Am I missing something here?

I would also like to directly call a method from the telephony manager to get current cell strength, as opposed to a listener, if possible. If anyone knows how, please let me know. Thanks.

A: 

I think this method is not working very well because as written in the javadoc, onSignalStrengthChanged() is deprecated since api 2.0, and replaced by onSignalStrengthsChanged() (note the "s"), but unfortunatly this method is private !

There is an open issue about that, it seems google has removed the method for unknow reason (maybe because its not working well as you have noticed it), and it will be available in a next sdk release.

You just have to be patient then and vote here to speed up dev process !

kosokund
+1  A: 

Based on Android 1.5 sources (BatteryStatsImpl.java) notification is being sent only if signal changes between following states:

SIGNAL_STRENGTH_NONE_OR_UNKNOWN (99)
SIGNAL_STRENGTH_GREAT (16-32)
SIGNAL_STRENGTH_GOOD (8-15)
SIGNAL_STRENGTH_MODERATE (4-7)
SIGNAL_STRENGTH_POOR (0-3)

So in your case signal strength changes within the same range and you don't receive notifications.

I guess it is made to save battery.

cement
Great answer. Thanks.
Doughy