views:

30

answers:

0

So the problem is in getting real-time values of signal strength for the currently connected base station. When I use neighbor cell info, I always get fluctuating values of RSSI (what is definitely right). However, when I try to get signal strength for current cell I receive constant value (it shows me -63 dBm (25 asu) all the time). The source code is below: Class:

public class GetParams extends PhoneStateListener 
{

    @Override  
    public void onSignalStrengthsChanged(SignalStrength signalStrength)
    {
         super.onSignalStrengthsChanged(signalStrength);
         signaldBm = -113 + 2*signalStrength.getGsmSignalStrength();
         //BER = signalStrength.getGsmBitErrorRate();
         isGSM = signalStrength.isGsm();
    }
}

Method:

public void dumpLocation(Location location)
 {
 Calendar cal = Calendar.getInstance();
 int day = cal.get(Calendar.DATE);
 int month = cal.get(Calendar.MONTH) + 1;
 int year = cal.get(Calendar.YEAR);
 int hour = cal.get(Calendar.HOUR_OF_DAY);
 int minute = cal.get(Calendar.MINUTE);
 int second = cal.get(Calendar.SECOND);

 GetParams listener = new GetParams();
 TelephonyManager TelManager = ( TelephonyManager )getSystemService(Context.TELEPHONY_SERVICE);
 TelManager.listen(listener ,PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
 if(display.getLineCount()<=16)
 {
 log("\nTime: "+ hour+":"+minute+":"+second);
 log("\nSignal strength is " + signaldBm+" dBm");
 log("\nLocation is unidentified");}
 else 
 {
 display.setText("Retrieved results (History cleared):\n");
 log("\nTime: "+ hour+":"+minute+":"+second);
 log("\nSignal strength is " + signaldBm+" dBm");
 log("\nLocation is unidentified");}
 }

If I use code from Source code written by Flo, the result is the same. Any advice?