Hi,

I think you should tell to us what you are trying to do cause repeating that you do startService the second time and it "does not work" doesn't mean a thing if we don't know what you want to do and what your service does.

Regards,
Daniele Segato

On 08/08/2013 08:32 PM, ashish wrote:
Hi,
if one service is working in the background and we again start the
service then onstart method for second time does not work until first
one finish execution

On Thursday, August 8, 2013 10:08:54 AM UTC-8, Streets Of Boston wrote:

    Send another Intent (different action) to the IntentService.
    Override the onStartCommand to catch this Intent and this could
    allow you to stop/interrupt the ongoing process in the
    IntentService's background thread.

    On Thursday, August 8, 2013 2:04:33 PM UTC-4, ashish wrote:

        Hi,

        if a service starts a  new thread then how i can stop the
        service from the other class.

        On Thursday, August 8, 2013 3:51:19 AM UTC-8, Kristopher
        Micinski wrote:

            Usually you use a service to coordinate a thread.

            FYI most of the time you don't want to outright kill a
            thread (e.g., if it's about to return from a download
            operation), you want to periodically check a flag.

            You probably don't want to use threads in their raw fashion
            (from activities) for a few reasons, one of which being that
            with configuration changes they're trickier to get right.
              Instead if you need background work that fits the model,
            an AsyncTask is an appropriate design.

            Kris


            On Thu, Aug 8, 2013 at 7:40 AM, ashish <ashis...@gmail.com>
            wrote:

                I read about services in Android very carefully, but I
                didn't find any valid reasons to use it. E.g.

                 1.

                    By default services run in the main thread, which
                    most of the applications don't want.

                 2.

                    A service can run on a seperate thread if it spawns
                    it own thread. But if a service runs on a seprate
                    thread, then the method |stopService(new
                    Intent(getApplicationContext(),
                    MyService.class));| does not stop the running
                    service. Again this is a problem.

                If we want to do some background operations, then I
                think threads are better than services. Am I right?

                --
                You received this message because you are subscribed to
                the Google
                Groups "Android Developers" group.
                To post to this group, send email to
                android-d...@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
                <http://groups.google.com/group/android-developers?hl=en>
                ---
                You received this message because you are subscribed to
                the Google Groups "Android Developers" group.
                To unsubscribe from this group and stop receiving emails
                from it, send an email to
                android-developers+unsubscr...@googlegroups.com.
                For more options, visit
                https://groups.google.com/groups/opt_out
                <https://groups.google.com/groups/opt_out>.



--
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
---
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
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
--- You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to