开发者

Android: Why are methods for getting neighboring cell signal strengths better than those for current cell signal strength?

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 开发者_JS百科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.


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 done this way to save battery life.


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 !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜