Yes, this is exactly what services are for.

Services are a way to tell Android that certain code in your application is important to the user, and Android should make an effort to keep it running even when it doesn't have active activities.

For user notifications, take a look at NotificationManager and its related class, Notification.

-- Kosyta

14.06.2010 17:54, tarek attia ?????:
Thank you so much for such help ,,,,

Again all my application requires the following :-

   1. The application should be able to run in the background
      when other applications are running in the foreground.
   2. When the application is on the foreground, it should shows
      certain stuff to the user

So Service is the best candidate for that ??

On Mon, Jun 14, 2010 at 1:09 AM, Olivier Guilyardi <[email protected] <mailto:[email protected]>> wrote:

    On 06/14/2010 12:00 AM, Olivier Guilyardi wrote:
    > On 06/13/2010 06:49 PM, tarek attia wrote:
    >> Thanks you so much for this clarification ,,exactly I want to
    make an
    >> application that keeps running while the user may went of the main
    >> application ,,and I guess Service will be the best candidate
    for doing
    >> that  ,,,,,,,
    >>
    >> But what if the application will take much time ,,so should I
    make a
    >> thread that embedded inside it a Service??
    >
    > Yes, exactly. If you need to do something heavy in the service,
    it must happen
    > in a dedicated thread, otherwise you will freeze the application
    main thread
    > (and thus the UI) which you should never do.
    >
    > So, you might need both a service *and* a thread.

    Little clarification: of course this thread must be "embedded" in
    the service,
    not the opposite. The service acts as an entry point, in which you
    can create
    several threads if you like.

    --
     Olivier

    --
    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]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:android-developers%[email protected]>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en




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


--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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