IT. Expert System.

Android Reference

IntentService


android.app

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:
    AsyncTask
    • Constructor Detail

      • IntentService

        public IntentService(String name)
        Creates an IntentService. Invoked by your subclass's constructor.
        Parameters:
        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.
        Overrides:
        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.
        Overrides:
        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
        Parameters:
        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.
        Returns:
        Return an IBinder through which clients can call on to the service.
        See Also:
        Service.onBind(android.content.Intent)
      • 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().
        Parameters:
        intent - The value passed to Context.startService(Intent).


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

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

License.
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: 203 / 158674456. Delta: 0.04598 с