Thanks a lot Mark! This is exactly what i was looking for.. It
works..

    Regards,
      Prafull.

On May 1, 6:25 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> madmaxwrote:
> >              I have an AndroidServicethat runs indefinitely
>
> That's not possible and is not a good idea in general:
>
> http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-a...
>
> > and
> > wants to notify when a specific interesting event occurs to an
> > activity. Now the problem is the "interesting event" occurs anytime
> > and i don't want to "poll" to theserviceall the time to get that
> > event... Theserviceitself should "notify" the activity about the
> > event occuring. I looked around and came across a few methods to do
> > it.
> > 1) Using Intents and putExtras() : This method wont suffice for me
> > because i "don't" want to start a new activity all  the time.
> > 2) Using aidl : I already have an aidl for communication between the
> >serviceand activity. This is essentially the polling mechanism.
>
> Have theservicesend a broadcast Intent via sendBroadcast(), and have
> the activity (when it is on-screen) dynamically register for that Intent
> via registerReceiver().
>
> Here is a sample project from one of my books that demonstrates the
> technique:
>
> http://github.com/commonsguy/cw-android/tree/master/Service/WeatherPlus/
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training...At Your Office:http://commonsware.com/training
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to