Yes I did fix this. mTelManager.listen(mSignalListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
Simple when you know how!! On Jul 23, 7:10 am, mac <[email protected]> wrote: > Hi TAO, > > Have you figured this out? I'm having the exact same problem. > > I've tested my app on G1 (1.5), Nexus One (2.1), Droid (2.1), and EVO > (2.1). > > The new API onSignalStrengthsChanged(SignalStrength signalStrength) > never got called on all 2.1 devices. But the funny part is the old API > onSignalStrengthChanged(int asu) worked correctly on Nexus One, but > not on Droid or EVO. > > Please let me know if you are able to fix this problem. > > Thanks. > > Mac > > On Jul 3, 12:12 pm, TheArchedOne <[email protected]> wrote: > > > > > I have written an android app which listens to the phone signal > > strength. The app works perfectly with Android 1.6 and lower using > > PhoneStateListener.SignalStrengthChanged(int asu), but I can't get it > > to work on Android 2.1. > > > I know that I have to use onSignalStrengthsChanged(SignalStrength > > signalStrength) but this override never seems to be called in my code. > > SignalStrengthChanged(int asu) is called, but this always returns a > > signal strength of -1 asu because its been depecated. I need to get > > the onSignalStrengthsChanged(SignalStrength signalStrength) to > > work.... does anyone know what I'm doing wrong? > > > I'm testing on a EVO with Android 2.1. The phone type > > (TelephonyManager.getPhoneType) is CDMA and > > TelephonyManager.getNetworkType returns "EVDO_A". > > > Here's the code: > > > mSignalListener = new PhoneStateListener(){ > > @Override > > public void onSignalStrengthChanged(int asu){ > > Log.d(Utils.LOGTAG, "#1. " + String.valueOf(asu)); > > if (mStrength != asu){ > > mStrength = asu; > > NotifyUI(); > > } > > super.onSignalStrengthChanged(asu); > > } > > > @Override > > public void onSignalStrengthsChanged(SignalStrength signalStrength) > > { > > Log.d(Utils.LOGTAG, "#2."); // this never gets called > > > if (signalStrength.isGsm()) > > mStrength = signalStrength.getGsmSignalStrength(); > > else{ > > int strength = -1; > > if (signalStrength.getEvdoDbm() < 0) > > strength = signalStrength.getEvdoDbm(); > > else if (signalStrength.getCdmaDbm() < 0) > > strength = signalStrength.getCdmaDbm(); > > > if (strength < 0){ > > // convert to asu > > mStrength = Math.round((strength + 113f) / 2f); > > } > > > NotifyUI(); > > } > > super.onSignalStrengthsChanged(signalStrength); > > } > > > }; > > > mTelManager = > > (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); > > mTelManager.listen(mSignalListener, > > PhoneStateListener.LISTEN_SIGNAL_STRENGTH); > > > Thanks in advance > > > TAO -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

