IT. Expert System.

Android Reference


Class IntentService

  • All Implemented Interfaces:
    ComponentCallbacks, ComponentCallbacks2

    public abstract class IntentService
    extends Service
    IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand. Clients send requests through Context.startService(Intent) calls; the service is started as needed, handles each Intent in turn using a worker thread, and stops itself when it runs out of work.

    This "work queue processor" pattern is commonly used to offload tasks from an application's main thread. The IntentService class exists to simplify this pattern and take care of the mechanics. To use it, extend IntentService and implement onHandleIntent(Intent). IntentService will receive the Intents, launch a worker thread, and stop the service as appropriate.

    All requests are handled on a single worker thread -- they may take as long as necessary (and will not block the application's main loop), but only one request will be processed at a time.

    Developer Guides

    For a detailed discussion about how to create services, read the Services developer guide.

    See Also:
    • Constructor Detail

      • IntentService

        public IntentService(String name)
        Creates an IntentService. Invoked by your subclass's constructor.
        name - Used to name the worker thread, important only for debugging.
    • Method Detail

      • onCreate

        public void onCreate()
        Description copied from class: Service
        Called by the system when the service is first created. Do not call this method directly.
        onCreate in class Service
      • onDestroy

        public void onDestroy()
        Description copied from class: Service
        Called by the system to notify a Service that it is no longer used and is being removed. The service should clean up any resources it holds (threads, registered receivers, etc) at this point. Upon return, there will be no more calls in to this Service object and it is effectively dead. Do not call this method directly.
        onDestroy in class Service
      • onBind

        public IBinder onBind(Intent intent)
        Unless you provide binding for your service, you don't need to implement this method, because the default implementation returns null.
        Specified by:
        onBind in class Service
        intent - The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.
        Return an IBinder through which clients can call on to the service.
        See Also:
      • onHandleIntent

        protected abstract void onHandleIntent(Intent intent)
        This method is invoked on the worker thread with a request to process. Only one Intent is processed at a time, but the processing happens on a worker thread that runs independently from other application logic. So, if this code takes a long time, it will hold up other requests to the same IntentService, but it will not hold up anything else. When all requests have been handled, the IntentService stops itself, so you should not call Service.stopSelf().
        intent - The value passed to Context.startService(Intent).


Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)





Java Script








Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 165 / 158872844. Delta: 0.04686 с