On Wed, Feb 2, 2011 at 12:01 AM, petko <[email protected]> wrote:
> hi, have the following code :
>
> public class OnCallReceiver extends BroadcastReceiver{
>        @Override
>        public void onReceive(Context context, Intent intent) {
>                Log.i(this.getClass().getSimpleName(), " on Receive called ");
>                TelephonyManager tm =
> (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
>                Log.i(this.getClass().getSimpleName(), " starts listening ");
>                tm.listen(new OnCallPhoneStateListener(context),
> PhoneStateListener.LISTEN_CALL_STATE);
>        }
> }
> public final class OnCallPhoneStateListener extends PhoneStateListener
> { ....}
>
> It functionally works. OnCallPhoneStateListener gets called correctly,
> shows some info with a Toast.
> However, i think a new instance gets created and starts to listen
> every time onReceive is called.

If that receiver is registered in the manifest, then yes, each
instance lives for exactly one onReceive() call.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://bit.ly/smand1 and http://bit.ly/smand2

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

Reply via email to