Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
264 views
in Technique[技术] by (71.8m points)

rssi - 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 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...