Hi Ricardo

An IntentService is perfect for your purpose.
Wrap every notification in an Intent and send it to the IntentService
(startService(Intent)).
The service will start as needed and handles each Intent using a
worker thread to keep the ui thread responsive. If it runs out of work
it stops itself.
Should your app crash or should Android decide it needs to destroy the
service because it needs resources for other purposes, the service
will be restarted as soon as possible. To achieve this you must call
setIntentRedelivery(true) in your constructor.

IntentServices are not a solution for your problem if you want to
process several requests at a time, but you can easily extend Service
to handle multiple requests simultaneously.

Ah and RTM: 
http://developer.android.com/guide/topics/fundamentals/services.html.

Cheers
Emanuel Moecklin
1gravity LLC

On Sep 28, 8:48 pm, Ricardo Amaral <[email protected]> wrote:
> This app I'm developing is strong in notifications. I've done some
> testing with them and realized that when my activity closes, the
> notifications remain pretty much alive. But when the app itself force
> closes, the notifications disappear.
>
> I was looking into introducing a service to my app and handle all
> notifications through the service instead of an activity. But since
> the app and the service run on the same UI thread, will the service
> also close when my app force closes?
>
> If so, the notifications will be removed as they were before and the
> service is useless for what I'm trying to achieve... Is there any
> other way to solve this problem or I just have to do my best so my app
> doesn't force close?

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