hi..
this all package is now not there now thery directly give signal
values,,,no need to register the intent receiver...
this is the code
TelephonyManager SignalManager = (TelephonyManager)getSystemService
(Context.TELEPHONY_SERVICE);
gnalManager.listen(signalListener,
PhoneStateListener.LISTEN_SIGNAL_STRENGTH);
PhoneStateListener signalListener=new PhoneStateListener()
{
public void onSignalStrengthChanged(int asu)
{
Log.e("onSignalStrengthChanged: "+asu," hello"+Status);
}
};
write this code inside the oncreate function.....
cheers..
by bins...
On Mar 13, 3:28 am, [email protected] wrote:
> This can be done, but it is a bit of an advanced topic. You'll need
> to use an internal class which is
> com.android.internal.telephony.PhoneStateIntentReceiver
>
> Grab this package, the .class files from the cupcake source tree
> repository , (doesn't ship with the SDK) and add the classes to you're
> class path, and include in the /libs directory, or package them into
> your existent android.jar file.
>
> Code to get the signal strength is as follows:
>
> import com.android.internal.telephony.PhoneStateIntentReceiver;
> private static final int EVENT_SIGNAL_STRENGTH_CHANGED = 200;
> ..
> /// first initialize the PhoneStateIntentReceiver (assumes you're
> inside a class that extends Context)
>
> void initPhoneStateReciever()
> {
> phoneStateReciever = new PhoneStateIntentReceiver(this, new
> Handler( getMainLooper()));
> phoneStateReciever.notifySignalStrength
> (EVENT_SIGNAL_STRENGTH_CHANGED);
> phoneStateReciever.registerIntent();
> }
>
> //to get the signal strength, use this method, or something similar
>
> void updateSignalStrength()
> {
> int signalDbm = phoneStateReciever.getSignalStrengthDbm();
> int signalAsu = phoneStateReciever.getSignalStrength();
> System.out.println("Time: "+System.currentTimeMillis()+"
> Signal Strength DB: "+signalDbm+" strength Asu: "+signalAsu);
> }
>
> The use of internal classes is not officially supported, and you'll
> need to grab the .class files from the source repo, but I do actually
> have code that implements and is tested on the G1. Refer to other
> threads on options for getting the code and setting up your
> development environment to use internal classes. Good luck!
>
> Mark
>
> On Mar 11, 7:49 am, Shrikant Agrawal <[email protected]> wrote:
>
> > Hi
>
> > I want to find the network signal strength for my app.
> > But I cant find the api for it.
>
> > Do anybody know how to find the signal strength of the phone?
>
> > Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---